-
Notifications
You must be signed in to change notification settings - Fork 100
chef solo doesn't update shared folder #17
Comments
what version of vagrant and berkshelf-vagrant? |
vagrant 1.1.5 And the vagrant-vmware-fusion provider (0.4.2) |
Please try again with vagrant-berkshelf 1.2.0 and see if it's fixed. (Yes, we renamed it. You can uninstall berkshelf-vagrant.) |
This is still an issue with vagrant-berkshelf 1.2.0, vagrant 1.2.2, using the.. LXC provider ;) version 0.3.3 |
vagrant-berkshelf 1.2.0, vagrant 1.2.2, virtualbox, same issue. I picked a bad month to try out Berkshelf; took me forever to realize this wasn't my fault. |
@icambron could you set the environment variable Thanks! |
@reset, just to confirm, you want the results of |
I'm experiencing this bug as well, also using vagrant-lxc as the provider instead of the default virtualbox provider. The following gist contains: If you 'vagrant ssh' into the guest after vagrant up and 'ls /tmp/vagrant-chef-1/chef-solo-1/cookbooks/' you will see all the relevant cookbooks have been loaded onto the guest. If you do so after a vagrant provision run, there are no cookbooks in that directory at all... it's completely empty. Not positive if this is a bug in berkshelf, or if vagrant-lxc is violating some contract that a provider is supposed to fulfill... but it sounds like some folks are experiencing it with the vmware-fusion provider as well. Version info: $ vagrant plugin list |
hey guys, @mikelococo pointed out to this issue to me on twitter and I'm willing to help those having a hard time getting this plugin to play well with vagrant-lxc. |
@fgrehm Hello! Here's where we hook into provision: https://github.com/RiotGames/vagrant-berkshelf/blob/master/lib/berkshelf/vagrant/plugin.rb#L7 Do you use ::Vagrant::Action::Builtin::Provision or a different action? |
@ivey yup, I'm using the builtin action over there too. are you guys by any chance trying to mount new shared folders after the machine is up? right now vagrant-lxc requires shared folders to be defined before bringing the machine up as they are passed on as an argument to |
@fgrehm You had asked for a repo that can repro the issue. I've created a hello-worldy cookbook that uses berkshelf just to pull in and run opscodes apt cookbook: https://github.com/mikelococo/demo-berkshelf-17 Instructions for use are in the readme, or ping me in this bug or on twitter for support working through the chef toolchain. |
@mikelococo tks a lot for taking the time to put this up :-) I'll look into it ASAP |
Using VMWare Fusion, An initial My current workaround was to |
@sethvargo Do you have the latest version of vagrant-vmware-fusion plugin? That sounds like #24 that was fixed in v0.6.2. |
@tmatilai yea. and newest version. |
Ah yeah, now I understand the issue. Sorry for the noise. |
Hey guys, I think I've got a fix for this, the problem seems to be on berkshelf itself. I'll try to send a PR for it tonight or tomorrow :) |
Hey guys, I've just sent a PR to Berkshelf which should fix this issue (at least for the lxc provider), for those willing to try it out, you can monkey patch module Berkshelf
class Berksfile
def self.vendor(cookbooks, path)
chefignore = nil
path = File.expand_path(path)
scratch = Berkshelf.mktmpdir
FileUtils.mkdir_p(path)
unless (ignore_file = Berkshelf::Chef::Cookbook::Chefignore.find_relative_to(Dir.pwd)).nil?
chefignore = Berkshelf::Chef::Cookbook::Chefignore.new(ignore_file)
end
cookbooks.each do |cb|
dest = File.join(scratch, cb.cookbook_name, "/")
FileUtils.mkdir_p(dest)
# Dir.glob does not support backslash as a File separator
src = cb.path.to_s.gsub('\\', '/')
files = Dir.glob(File.join(src, "*"))
# Filter out files using chefignore
files = chefignore.remove_ignores_from(files) if chefignore
FileUtils.cp_r(files, dest)
end
# This is the patch!
FileUtils.rm_r Dir.glob("#{path}/*"), force: true, secure: true
FileUtils.mv Dir.glob("#{scratch}/*"), path
FileUtils.remove_dir(scratch, force: true)
path
end
end
end |
I tested via the Vagrantfile monkey patch described above, which fixes the issue with no side effects that I can observe. I look forward to seeing this merged and released. @fgrehm Thanks for looking into this even though you're not a chef user. Having vagrant-lxc be fully compatible with berkshelf is much appreciated. |
Update: we're going to be re-working how we update existing vendor directories, moving towards a full tree-traversal with add/remove. This is targeted for 3.0. In the meantime, if we want berkshelf/berkshelf#525 to come in, we'll need some tests around it. @sethvargo also had a few concerns about hidden files. |
berkshelf/berkshelf#525 was closed some time ago, but I'm still having the issue discussed here. @fgrehm's patch fortunately works, but that looks rather fragile to me and I'm wondering what can be done to fix this issue. |
When I run
vagrant up
all cookbooks are updated in the appropriate~/.berkshelf/vagrant/berkshef-*
directory, but when I make a change to a cookbook and runvagrant provision
the cookbooks aren't updated. If I runtvagrant halt
followed byvagrant up
the cookbooks are updated again. Is there a hook missing for the vagrant provision task? I'm using the fusion provider if that helps.Thanks!
The text was updated successfully, but these errors were encountered: