-
Notifications
You must be signed in to change notification settings - Fork 89
Description
If I run the command vagrant package --vagrantfile Vagrantfile --output mybox.box with the following vagrantfile:
#Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "test"
config.vm.provision "shell", inline: <<-SHELL
echo "HELLO WORLD"
SHELL
endThe box is created however when I import and run the newly created box the vagrantfile isn't obeyed and it never echo's HELLO WORLD.
However when I do this using the virtualbox provider it works ok.
I am not sure but when I extracted mybox.box I found my vagrantfile inside the includes directory however it was _Vagrantfile rather than Vagrantfile, which it wasn't when I checked the virtualbox equivalent.
Any ideas how I can fix this?
EDIT:
Thought I would add some steps to reproduce to make this easier.
-
Create a new vagrant box
vagrant init bento/ubuntu-16.04 -
Create a new Vagrantfile with a shell provisioner top test with
echo 'Vagrant.configure("2") do |config| config.vm.provision "shell", inline: <<-SHELL echo "HELLO WORLD" SHELL end' > NewVagrantFile -
Launch the box
vagrant up -
Package the box
vagrant package --vagrantfile NewVagrantFile -
Add the new box
vagrant box add newbox package.box -
Create new vagrant box and test
mkdir newbox && cd newbox
vagrant init newbox
vagrant up
You would expect to see the shell provisioner from NewVagrantFile say "HELLO WORLD" while provisioning but it doesn't. These steps do work with the virtualbox provider.