Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Butcher not triggered when using Vagrant 1.7.1 and Butcher 2.2.0 #57

Closed
Yserz opened this issue Dec 13, 2014 · 9 comments
Closed

Butcher not triggered when using Vagrant 1.7.1 and Butcher 2.2.0 #57

Yserz opened this issue Dec 13, 2014 · 9 comments

Comments

@Yserz
Copy link

Yserz commented Dec 13, 2014

Butcher seems not to be triggered when using Vagrant 1.7.1 and Butcher 2.2.0. There's no error nor any other output.

@c10l c10l closed this as completed in 81cc73c Dec 15, 2014
@Yserz
Copy link
Author

Yserz commented Dec 17, 2014

Thx 4 the fix :)

Unfortunately the client and node are not removed anymore on vagrant destroy :/. When I inspected the behavior in more detail I saw butcher is never creating his folder under the .vagrant folder.

Heres the log https://gist.github.com/Yserz/96ce0cd7e478a5b57dba

@c10l
Copy link
Owner

c10l commented Dec 18, 2014

I couldn't reproduce this issue...
Would you mind trying it out with a clean vagrant install with only vagrant-butcher installed as a plugin? Just trying to isolate the problem as it might be caused by incompatibility with another plugin. Vagrant's plugin system is a bit of a moving target and not very well documented.
Also, if possible could you share your Vagrantfile and/or the base box you're using?
Thanks! :)

@Yserz
Copy link
Author

Yserz commented Dec 18, 2014

For now I can give you the Vagrantfile and the box. I'll test it with a clean Vagrant when I have more time. Would it be sufficient to deinstall every plugin except the butcher one?

Vagrantfile: https://github.com/welovecoding/wlc-virtual-infrastructure/blob/master/vm-wlc-test/Vagrantfile
Unfortunately it's not executable without the whole infrastructure stuff :/

Box: https://atlas.hashicorp.com/wlc/boxes/centos-7.0

Note that chef is executed without any items in the runlist. Thus chef is not creating a node on the server (but a client). Maybe that's a part of the problem? On the other side butcher is never creating his butcher-folder so the problem is probably way before.

@c10l
Copy link
Owner

c10l commented Dec 18, 2014

That should do it.

Thanks for the files. I'll try with them and see what happens.

@Yserz
Copy link
Author

Yserz commented Dec 19, 2014

Okay, I figured out it's a problem with the vagrant-cachier plugin, again <.<
As soon as I add the line config.cache.scope = :box , which enables the plugin, butcher isn't working anymore. Probably they have the same problem with the changed attribute.

@c10l
Copy link
Owner

c10l commented Dec 19, 2014

I see... Well, let's wait for @fgrehm on fgrehm/vagrant-cachier#133 . Hopefully when vagrant-cachier gets fixed this will work as expected.

@Yserz
Copy link
Author

Yserz commented Dec 22, 2014

I was able to monkeypatch it like this:

# Fixes https://github.com/fgrehm/vagrant-cachier/issues/133
module VagrantPlugins
  module Cachier
    module Cap
      module Linux
        module ChefFileCachePath
          def self.chef_provisioner?(machine)
            provisioners = machine.config.vm.provisioners
            chef_provisioners = [:chef_solo, :chef_client]
            compat_provisioners = provisioners.keep_if { |p| chef_provisioners.include? p.name || p.type }
            if compat_provisioners.size > 1
              raise "One machine is using multiple chef provisioners, which is unsupported."
            end

            using_chef = compat_provisioners.empty? ? false : true
            using_chef
          end
          def self.chef_file_cache_path(machine)
            chef_file_cache_path = nil
            chef_file_cache_path = '/var/chef/cache' if chef_provisioner?(machine)

            return chef_file_cache_path
          end
        end
      end
    end
  end
end

VagrantPlugins::Cachier::Plugin.guest_capability 'linux', 'chef_file_cache_path' do
  VagrantPlugins::Cachier::Cap::Linux::ChefFileCachePath
end

Vagrantfile: require_relative 'path/to/patch.rb'

I can confirm butcher is working correctly with that cachier-patch.

c10l pushed a commit to c10l/vagrant-cachier that referenced this issue Dec 25, 2014
Using [Array#keep_if](http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-keep_if) on a Vagrant core object can lead to unpredictable behaviour down the line as it modifies the object instead of creating a new one.

An example of such interference is described on c10l/vagrant-butcher#57. The problem with `keep_if` was identified by @sethvargo on this issue: hashicorp/vagrant#5060 (comment)
@c10l
Copy link
Owner

c10l commented Dec 25, 2014

The root cause of the interference between the plugins was identified by @sethvargo on hashicorp/vagrant#5060. I sent a pull request for vagrant-cachier to fix that.

@tknerr
Copy link

tknerr commented Jan 15, 2015

See also hashicorp/vagrant#5069 (for the provisioner name vs type issue)

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

No branches or pull requests

3 participants