applicationsonline / librarian

Librarian - A Framework for Bundlers. Librarian-Chef is at: https://github.com/applicationsonline/librarian-chef.
http://applicationsonline.com/
MIT License
655 stars 71 forks source link

Avoid installation path removal #151

Open fgrehm opened 11 years ago

fgrehm commented 11 years ago

I've just started playing out with the Chef + Vagrant combo and while using vagrant-librarian-chef under vagrant-lxc I've hit an issue that vagrant-berkshelf users have reported to me in the past related to cookbooks installation.

The problem is this line and I worked around it by adding the code below to my Vagrantfile

require 'librarian/action'
class Librarian::Action::Install < Librarian::Action::Base
  def create_install_path
    if install_path.exist?
      FileUtils.rm_rf("#{install_path}/.", secure: true)
    end
    install_path.mkpath
  end
end

The problem with the current approach of recreating the whole directory messes up with vagrant-lxc shared folders / bind mounts and the guest container is no longer able to see the updated cookbooks after vagrant-librarian-chef kicks in. Without that change I can only provision my containers once and I'm not able to run vagrant provision after the machine is up.

I've already submitted a PR for Berkshelf and I'm up for doing the same here if you guys are up for doing the change :)

/cc @jimmycuadra

tmatilai commented 10 years ago

I haven't tested it, but this most probably breaks also vagrant provision with the VMware Fusion provider, and even with the Virtualbox provider when using NFS. See RiotGames/vagrant-berkshelf#88.

sbuzonas commented 10 years ago

This does affect VirtualBox with NFS and this works to solve the problem there.