Open yoshiwaan opened 9 years ago
vagrant rsync
can be used to manually sync the folders before running vagrant provision
. It would be good if this could be called upon reload/provision for instances using the aws provider.
Hi,
I'm stuck too with this problem... But i'm not destroying every time I need to update my cookbooks (also not using thevagrant-berkshelf plugin). Instead i'm having to delete the synced_folders file and reloading with --provision option.
I think that is a Vagrant problem, not vagrant-aws. Cause i'm having this problem every time I need to start my VM's locally (with Virtualbox).
You don't need to run reload --provision for synced folders, you can just run vagrant rsync to sync folders.
I think this most probably is a vagrant-aws problem because when running on a local provider like virtualbox both the /vagrant folder and the location of the chef cookbooks for berkshelf (the shelf, usually in ~/.berkshelf/vagrant-berkshelf/shelves) are mounted to the VM. In vagrant-aws these are changed to be synced folders (via rsync) instead of mounts. When running vagrant provision the /vagrant directory is synced but the shelf isn't.
Ideally vagrant-aws would add an rsync to the job queue before running provisioning.
On 19 May 2015 at 17:57, Gustavo Vinícius notifications@github.com wrote:
Hi,
I'm stuck too with this problem... But i'm not destroying every time I need to update my cookbooks (also not using thevagrant-berkshelf plugin). Instead i'm having to delete the synced_folders file and reloading with --provision option.
I think that is a Vagrant problem, not vagrant-aws. Cause i'm having this problem every time I need to start my VM's locally (with Virtualbox).
— Reply to this email directly or view it on GitHub https://github.com/mitchellh/vagrant-aws/issues/385#issuecomment-103709174 .
By design. This is the reason this happens: https://github.com/mitchellh/vagrant-aws/pull/347
However, if the owners of this repo want to sync folders before provision, this is a one-line change, just run the SyncedFolders action before Provision:
def self.action_provision
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsCreated do |env, b2|
if !env[:result]
b2.use MessageNotCreated
next
end
b2.use SyncedFolders
b2.use Provision
end
end
end
Thanks @Temikus. I'd actually already tried adding b2.use SyncedFolders to the action_provision for vagrant-aws but it produces behavior I don't understand.
With the following (and running vagrant-berkshelf and the chef provisioner):
# This action is called when `vagrant provision` is called.
def self.action_provision
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsCreated do |env, b2|
if !env[:result]
b2.use MessageNotCreated
next
end
b2.use Provision
b2.use SyncedFolders
end
end
end
The order of operation goes
If I change to this:
# This action is called when `vagrant provision` is called.
def self.action_provision
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsCreated do |env, b2|
if !env[:result]
b2.use MessageNotCreated
next
end
b2.use SyncedFolders
b2.use Provision
end
end
end
Then the order goes:
That's not a typo, putting SyncedFolders first results in the sync happening after chef, putting sync after provision results in the sync happening before chef. I'm not sure why.
In any case, in both instances only the /vagrant directory is synced, not any other synced folders (including the berkshelf shelf for the instance). This is despite the berkshelf directory being listed in .vagrant/machines/default/aws/synced_folders and running vagrant rsync
syncing all directories.
This then starts to lead me down the rabbit hole of how SyncedFolders work, whether they differ from what happens when you run vagrant rsync
how the berkshelf plugin is synced when vagrant up is run and so on, which maybe I'll get to one day.
vagrant-librarian-puppet
. Prior to #347, all that was requires was to run vagrant provision <foo>
. Post, you have to run vagrant provision <foo>
in order to trigger librarian-puppet
and wait through an unneeded puppet run, then run vagrant rsync <foo>
to copy the modules over to the box, and then run vagrant provision <foo>
again, this time waiting through an unnecessary librarian-puppet
update before the "effective" puppet run takes place.@jhoblitt Maybe file an upstream bug asking for clarification in the behavior? I can file one myself, but I don't use AWS/puppet much, so it may be tough for me to follow-up on those questions.
It's not just puppet, vagrant-berkshelf has the same problem. In fact anything that relies on synced folders outside of the vagrant directory won't work
Hi,
I'm using vagrant-aws and vagrant-berkshelf for cookbook development on Amazon Linux. I'm stuck at the moment having to
vagrant destroy
andvagrant up
every time I need to update cookbooks on a host at the moment asvagrant provision
does not update cookbooks on the instance. Runningvagrant reload --provision
also does not update the cookbooks.When running directory that matches the instance. The recipe files in /vagrant/recipes on the instance also update for the cookbook that the instance relates to.
vagrant provision
I can see the cookbooks being vendored by the vagrant-berkshelf plug-in and the code updates in the ~/.berkshelf/vagrant-berkshelf/shelves/The problem is that the cookbooks in /tmp/vagrant-chef don't update. When initially running
vagrant up
there is a line like this:Which does not run when using
vagrant provision