How to package files with a Vagrant box?

爱⌒轻易说出口 提交于 2019-12-06 01:29:49

问题


So I created a Vagrant box with the following command:

vagrant package --base box_name_here --vagrantfile Vagrantfile --include manifests/

manifests/ is a directory with a puppet manifest and some subdirectories with some files used during the provisioning process. Puppet is called in the Vagrantfile like so:

config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "manifests"
    puppet.manifest_file  = "web-dev.pp"
end

When I explore the packaged .box archive Vagrant creates, I see the folder located at box_name_here.box/includes/manifests. However, vagrant up dies with the following error when I try to run it:

The manifests path specified for Puppet does not exist: c:/vagrant/manifests

Are the files somewhere else?

I saw this post: https://github.com/mitchellh/vagrant/issues/344

But the answer is a bit opaque; I don't quite know how to translate the modulepath response to my manifests_path problem.

I altered the vagrantfile so that the line reads

puppet.manifests_path = "./manifests"

...but that did not correct the problem. I still get the same error message.


回答1:


After some experimentation, the incredibly obvious answer is:

puppet.manifests_path = File.expand_path("../manifests", __FILE__)


来源:https://stackoverflow.com/questions/14084229/how-to-package-files-with-a-vagrant-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!