diff --git a/CHANGELOG.md b/CHANGELOG.md index c81e445e1..e185bf3bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ environmental variable. - Removed check and error for the "OSE" version of VirtualBox, since with VirtualBox 4 this distinction no longer exists. + - Ability to specify proxy settings for chef. [GH-169] ## 0.7.0.beta (December 24, 2010) diff --git a/lib/vagrant/provisioners/chef.rb b/lib/vagrant/provisioners/chef.rb index 1e6056dd3..c757b5de7 100644 --- a/lib/vagrant/provisioners/chef.rb +++ b/lib/vagrant/provisioners/chef.rb @@ -25,7 +25,14 @@ module Vagrant def setup_config(template, filename, template_vars) config_file = TemplateRenderer.render(template, { - :log_level => env.config.chef.log_level.to_sym + :log_level => env.config.chef.log_level.to_sym, + :http_proxy => env.config.chef.http_proxy, + :http_proxy_user => env.config.chef.http_proxy_user, + :http_proxy_pass => env.config.chef.http_proxy_pass, + :https_proxy => env.config.chef.https_proxy, + :https_proxy_user => env.config.chef.https_proxy_user, + :https_proxy_pass => env.config.chef.https_proxy_pass, + :no_proxy => env.config.chef.no_proxy }.merge(template_vars)) vm.ssh.upload!(StringIO.new(config_file), File.join(env.config.chef.provisioning_path, filename)) @@ -80,6 +87,13 @@ module Vagrant attr_accessor :provisioning_path attr_accessor :log_level attr_accessor :json + attr_accessor :http_proxy + attr_accessor :http_proxy_user + attr_accessor :http_proxy_pass + attr_accessor :https_proxy + attr_accessor :https_proxy_user + attr_accessor :https_proxy_pass + attr_accessor :no_proxy def initialize @validation_client_name = "chef-validator" @@ -87,11 +101,17 @@ module Vagrant @cookbooks_path = ["cookbooks", [:vm, "cookbooks"]] @roles_path = [] + @provisioning_path = "/tmp/vagrant-chef" @log_level = :info - @json = { - :instance_role => "vagrant", - } + @json = { :instance_role => "vagrant" } + @http_proxy = nil + @http_proxy_user = nil + @http_proxy_pass = nil + @https_proxy = nil + @https_proxy_user = nil + @https_proxy_pass = nil + @no_proxy = nil end # Returns the run list for the provisioning diff --git a/templates/chef_solo_solo.erb b/templates/chef_solo_solo.erb index d1936b490..6a1a0910b 100644 --- a/templates/chef_solo_solo.erb +++ b/templates/chef_solo_solo.erb @@ -4,8 +4,16 @@ node_name "<%= node_name %>" file_cache_path "<%= provisioning_path %>" cookbook_path <%= cookbooks_path %> role_path <%= roles_path %> -log_level <%= log_level.inspect %> +log_level <%= log_level.inspect %> -<% if recipe_url %> +<% if recipe_url -%> recipe_url "<%= recipe_url %>" -<% end %> \ No newline at end of file +<% end -%> + +http_proxy <%= http_proxy.inspect %> +http_proxy_user <%= http_proxy_user.inspect %> +http_proxy_pass <%= http_proxy_pass.inspect %> +https_proxy <%= https_proxy.inspect %> +https_proxy_user <%= https_proxy_user.inspect %> +https_proxy_pass <%= https_proxy_pass.inspect %> +no_proxy <%= no_proxy.inspect %>