Skip to content

Commit

Permalink
Merge pull request #105 from tmatilai/support_chef_zero
Browse files Browse the repository at this point in the history
Add support for the chef_zero provisioner
  • Loading branch information
tmatilai committed Jan 15, 2015
2 parents d0c1274 + 77ca416 commit 1e8004c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Features:

- Ignore specific applications by passing a hash to `config.proxy.enabled` ([GH-93][])
- Support the `chef_zero` provisioner in Vagrant 1.7+ ([GH-105][])

Improvements:

Expand Down Expand Up @@ -204,3 +205,4 @@ Bug fixes:
[GH-93]: https://github.com/tmatilai/vagrant-proxyconf/issues/93 "Issue 93"
[GH-94]: https://github.com/tmatilai/vagrant-proxyconf/issues/94 "Issue 94"
[GH-103]: https://github.com/tmatilai/vagrant-proxyconf/issues/103 "Issue 103"
[GH-105]: https://github.com/tmatilai/vagrant-proxyconf/issues/105 "Issue 105"
17 changes: 11 additions & 6 deletions lib/vagrant-proxyconf/action/configure_chef_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module ProxyConf
class Action
# Action for configuring Chef provisioners
class ConfigureChefProxy

# Array of Chef provisioner types which include proxy configuration
CHEF_PROVISIONER_TYPES = [:chef_client, :chef_solo, :chef_zero]

def initialize(app, env)
@app = app
end
Expand Down Expand Up @@ -44,12 +48,13 @@ def config
# @return [Array] all Chef provisioners
def chef_provisioners
@machine.config.vm.provisioners.select do |prov|
# Since Vagrant > 1.7 the provisioner type is returned by the prov#type method
# (it used to be prov#name in older versions). Vagrant 1.7.0 broke prov#name
# so we rely on prov#type when possible and fallback to prov#name when not.
# See github issues #101 and mitchellh/vagrant#5069.
prov_type_method = [:type, :name].detect { |meth| prov.respond_to?(meth) }
[:chef_solo, :chef_client].include?(prov.public_send(prov_type_method))
# Vagrant 1.7+ uses #type, earlier versions #name
if prov.respond_to?(:type)
type = prov.type
else
type = prov.name
end
CHEF_PROVISIONER_TYPES.include?(type)
end
end

Expand Down

0 comments on commit 1e8004c

Please sign in to comment.