Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

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

Closed
trappar opened this issue Jan 14, 2015 · 5 comments
Closed

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

trappar opened this issue Jan 14, 2015 · 5 comments

Comments

@trappar
Copy link

trappar commented Jan 14, 2015

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
Copy link
Contributor

maxlinc commented Jan 14, 2015

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
Copy link
Author

trappar commented Jan 14, 2015

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
Copy link
Author

trappar commented Jan 14, 2015

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
Copy link
Contributor

maxlinc commented Jan 15, 2015

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.

@trappar trappar closed this as completed Jan 17, 2015
@vhosakot
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants