mitchellh / vagrant-rackspace

Use Vagrant to manage Rackspace Cloud instances.
MIT License
235 stars 155 forks source link

Rsyncs all folders on vagrant up - but not on vagrant provision #131

Closed trappar closed 9 years ago

trappar commented 9 years ago

Not sure if this is a vagrant-rackspace issue or a vagrant-berkshelf issue...

When running vagrant up I see the following lines in the output:

==> default: Rsyncing folder: /Users/trappar/Development/chef/testbook/ => /vagrant
==> default: Rsyncing folder: /Users/trappar/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150114-52105-1c4i8w7-default/ => /tmp/vagrant-chef/45ccab2ba49d3b740513bc910108d6be/cookbooks
==> default: Rsyncing folder: /Users/trappar/Development/chef/chef-server/data_bags/ => /tmp/vagrant-chef/f397084f58fed18af584ddb13a0f0f70/data_bags
==> default: Rsyncing folder: /Users/trappar/Development/chef/chef-server/environments/ => /tmp/vagrant-chef/ff430af9267b8c05c59c0a7b90675a89/environments

Then when running vagrant provision I get:

==> default: Rsyncing folder: /Users/trappar/Development/chef/testbook/ => /vagrant

The berkshelf one is quite necessary, since that's where the policy code lives and is executed from. The result of this is that I can provision correctly on vagrant up, but then any further changes to my policy code will never be synced with the server.

This works fine on providers other than the rackspace provider (virtualbox, vmware fusion/workstation, parallels), which is why I suspect it's an issue with this plugin.

maxlinc commented 9 years ago

Interesting. What version of vagrant and vagrant-rackspace are you using?

@smashwilson If there is a bug in this plugin there's a good chance it's already fixed by #129, since that removes all the legacy rsync code. I removed the WIP tag. Could you review it one last time and merge?

trappar commented 9 years ago

Vagrant 1.7.2 and vagrant-rackspace 0.1.10.

It appears that Vagrant is ignoring these folders because they already exist

As a temporary.. but really horrible solution I've added this to my Vagrantfile

config.vm.provision :chef_solo do |chef|
    chef.provisioning_path = "/tmp/vagrant-chef-#{Time.now.to_i}"
end

By changing the provisioning path on every run, the chef-solo provisioner doesn't find any existing folders and happily rsyncs everything over.

Seems like maybe this is some conflicting code. Like the code preventing syncing is appropriate for other forms of syncing but not at all for rsync? I don't know much about vagrant or vagrant plugin internals so mostly this is just poking around and guessing.

trappar commented 9 years ago

Also, I found that stuff by doing vagrant up --debug and vagrant provision --debug, so I know for sure that code I linked to is what's preventing those folders from syncing. I don't know why the main /vagrant folder continues to sync every time no matter what though.

maxlinc commented 9 years ago

Yeah, it may make sense for other synced folder types. Some other types are only setup during vagrant up or vagrant reload and remain shared as long as the VM is active. At least that's the case for virtualbox shared folders.

That explains virtualbox, and it's likely similar for vmware fusion and parallels, though I'm not sure how they handle synced folders by default. I also suspect that if you forced virtualbox to use rsync synced folders it would have the same bug.

I only see that check in chef-solo, so I suggest reporting it to vagrant as a possible bug in chef solo.

I'd also try out the vagrant rsync or rsync-auto commands, though they might have the same bug. In other words try vagrant rsync && vagrant provision as see if that works as an alternative workaround to changing your Vagrantfile.

vhosakot commented 6 years ago

When I did vagrant up with the box centos/7 (virtualbox, 1703.01), ==> default: Rsyncing folder: /root/ => /vagrant was stuck for me too, and adding config.vm.synced_folder '.', '/vagrant', disabled: true in Vagrantfile resolved the issue for me and rsync did not happen.