Proxy settings for chef. [closes GH-169]

This commit is contained in:
Mitchell Hashimoto 2011-01-08 23:30:07 -08:00
parent 968499bd5c
commit 101aa45226
3 changed files with 36 additions and 7 deletions

View File

@ -15,6 +15,7 @@
environmental variable. environmental variable.
- Removed check and error for the "OSE" version of VirtualBox, since with - Removed check and error for the "OSE" version of VirtualBox, since with
VirtualBox 4 this distinction no longer exists. VirtualBox 4 this distinction no longer exists.
- Ability to specify proxy settings for chef. [GH-169]
## 0.7.0.beta (December 24, 2010) ## 0.7.0.beta (December 24, 2010)

View File

@ -25,7 +25,14 @@ module Vagrant
def setup_config(template, filename, template_vars) def setup_config(template, filename, template_vars)
config_file = TemplateRenderer.render(template, { 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)) }.merge(template_vars))
vm.ssh.upload!(StringIO.new(config_file), File.join(env.config.chef.provisioning_path, filename)) 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 :provisioning_path
attr_accessor :log_level attr_accessor :log_level
attr_accessor :json 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 def initialize
@validation_client_name = "chef-validator" @validation_client_name = "chef-validator"
@ -87,11 +101,17 @@ module Vagrant
@cookbooks_path = ["cookbooks", [:vm, "cookbooks"]] @cookbooks_path = ["cookbooks", [:vm, "cookbooks"]]
@roles_path = [] @roles_path = []
@provisioning_path = "/tmp/vagrant-chef" @provisioning_path = "/tmp/vagrant-chef"
@log_level = :info @log_level = :info
@json = { @json = { :instance_role => "vagrant" }
: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 end
# Returns the run list for the provisioning # Returns the run list for the provisioning

View File

@ -4,8 +4,16 @@ node_name "<%= node_name %>"
file_cache_path "<%= provisioning_path %>" file_cache_path "<%= provisioning_path %>"
cookbook_path <%= cookbooks_path %> cookbook_path <%= cookbooks_path %>
role_path <%= roles_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 %>" recipe_url "<%= recipe_url %>"
<% end %> <% 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 %>