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

Add support for the chef_zero provisioner #105

Merged
merged 2 commits into from
Jan 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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