Open chris-orchard opened 9 years ago
I think this is the same problem as https://github.com/berkshelf/vagrant-berkshelf/issues/281
What I've found is that when running vagrant provision
on an instance that rsyncs folders instead of mounting them only the /vagrant data folder is rsynced. This isn't particularly helpful for chef/berkshelf as the cookbooks are stored in /tmp/vagrant-chef/
Looking at the synced_folders file for the machine in .vagrant/machines/default/vagrant rsync
will actually sync the cookbooks correctly if the local shelf is up to date.
The hack I worked out to get it working was to run vagrant provision
up until the cookbook dependencies are finished updating then CTRL+C it to cancel, then run vagrant rsync && vagrant provision
You may need to run a berks install
or berks update
before running the first vagrant provision
as the cookbooks are sourced from your berkshelf.
This was enough of a problem to make me switch to test kitchen, which works perfectly.
The way I see it there are 3 ways to fix the problems, none of which are perfect:
vagrant rsync
when vagrant provision
is runI just added the above ticket to base vagrant. Maybe one way of fixing the problem will get put in.
I'm having a possibly related problem with rsync to the issue in #281
The first time I run
vagrant provision
the cookbooks are synced across:Then if I change the
./Berksfile
to include extra cookbooks then runvagrant provision
again the new dependencies are fetched on my local machine, but rsync does not run so they are missing on the remote machine.Looks like something makes the plugin not re-sync the cookbooks after the first time.
If I
vagrant destroy
andvagrant up
again it copies them across.Interestingly if I change the
chef.provisioning_path = "/vagrant-berkshelf"
line in the chef-solo block of the Vagrantfile to a different path, saychef.provisioning_path = "/vagrant-berkshelf-2"
then it does sync new cookbook dependencies across. So it looks like it might be checking for something on the vm which makes it think it's up to date even if there are new cookbok dependencies in the local shelf that should be synced.