Discussion:
[vagrant-up] Including other files when packaging a box
Nc Diesel
2018-11-16 15:11:12 UTC
Permalink
So I package a box:

vagrant package --base MyDevelopment --output MyDevelopment-0.5.0.box
--include cookbooks --vagrantfile Vagrantfile

When I untar the box, cookbooks and its entire tree and the correct
Vagrantfile are in there. So far so good....

But no combination of "vagrant box add" and "vagrant init" that I can find
will create box with the cookbooks directory tree nor does it
create/overwrite the Vagrant file with the Vagrantfile packaged with the
box.

Any ideas what in the heck I am doing wrong??

Thanks in advance!
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/237b0b6e-4565-49da-b4f1-ad2a51ddc99a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nc Diesel
2018-11-16 17:23:07 UTC
Permalink
Sorry to reply to my own post, but I realize now that my Vagrantfile is
being executed. Just didn't look like it since it couldn't find the
cookbook files and therefore the output looked boilerplate. However, I am
still left with cookbook files that are not being found and therefore the
box isn't being provisioned. If I manually untar the cookbook files from
the *.box file, everything works as expected. But I feel like manual steps
to unpack the cookbook files is not the behavior I should expect, and
therefore I believe am still doing something wrong.
Post by Nc Diesel
vagrant package --base MyDevelopment --output MyDevelopment-0.5.0.box
--include cookbooks --vagrantfile Vagrantfile
When I untar the box, cookbooks and its entire tree and the correct
Vagrantfile are in there. So far so good....
But no combination of "vagrant box add" and "vagrant init" that I can find
will create box with the cookbooks directory tree nor does it
create/overwrite the Vagrant file with the Vagrantfile packaged with the
box.
Any ideas what in the heck I am doing wrong??
Thanks in advance!
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/a405b3c0-0c7d-40bc-ac10-9ec56a39de17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nc Diesel
2018-11-28 19:13:25 UTC
Permalink
This post might be inappropriate. Click to display it.
Alvaro Miranda Aguilera
2018-11-28 22:13:20 UTC
Permalink
hello

when you add a vagrant box, it will add it to:

~/.vagrant.d/boxes

when you include files in the box they get added in the compressed file of
the box.

think on the template vm on disk and other files.

When you do vagrant init, you are just creating a new Vagrantfile, that
tells the local project, what base box use (say a template)

At this moment, no files are copied from the ~/.vagrant.d/boxes to the
local directory.

When you do vagrant up, lets say with virtualbox, vagrant creates a VM in
the default path to have VMs in virtualbox settings.

At this moment, no files are copied from the ~/.vagrant.d/boxes to the
local directory.


So I am not sure I follow the bug part.

My suggestion will be check where the files end added, and see if you can
make it work.

However, i am not sure this is a bug.

no current operations copy files into the project folder, so is safe to
assume using chef, it won't copy them neither.

If you can specify the location, then on the included Vagrantfile you can
reference the path like

File.expand_path(File.dirname(__FILE__))

If you got a file named "file.ext", will be

File.expand_path(File.dirname(__FILE__))/file.ext

Alvaro
Post by Nc Diesel
So: No tip,tricks or hints on this? To get my cookbooks in a newly
created vagrant box and to have them present for provisioning I have to
copy them from $HOME/.vagrant.d/... into my working directory. This seems
like a bug to me. They should execute them in place from .vagrant.d or
"vagrant init" should copy them, it seems to me
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'mybox-050-2'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: 050Test-2_default_1543430081688_64
==> default: Auto-generating node name for Chef...
*==> default: The cookbook path
'C:/Users/XXXXXX/VagrantMachines/050Test-2/cookbooks' doesn't exist.
Ignoring...*
Post by Nc Diesel
vagrant package --base MyDevelopment --output MyDevelopment-0.5.0.box
--include cookbooks --vagrantfile Vagrantfile
When I untar the box, cookbooks and its entire tree and the correct
Vagrantfile are in there. So far so good....
But no combination of "vagrant box add" and "vagrant init" that I can
find will create box with the cookbooks directory tree nor does it
create/overwrite the Vagrant file with the Vagrantfile packaged with the
box.
Any ideas what in the heck I am doing wrong??
Thanks in advance!
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in
violation of those guidelines may result in your removal from this mailing
list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/4062862c-f250-4ec4-aeee-d76c061c217e%40googlegroups.com
<https://groups.google.com/d/msgid/vagrant-up/4062862c-f250-4ec4-aeee-d76c061c217e%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Alvaro
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0exxhdUVN4dRPNq6ujRjNZuB%2BgPqkdG6dL4gakvJYQNAng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...