Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Commit

Permalink
Merge branch 'proxy-configurations'
Browse files Browse the repository at this point in the history
Add proxy settings to solo.rb.erb

Closes #254
  • Loading branch information
tmatilai committed Jun 14, 2013
2 parents 7b64e7c + 50d9570 commit 58a68f6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Prepare/bootstrap now installs the same version of Chef that the workstation is running ([186])
* Switch `--omnibus-version` flag to `--bootstrap-version` ([185])
* Support `--override-runlist` option ([204])
* Add proxy settings to the generated solo.rb ([254])
* Support Fedora 18 and other new EL distros ([229], [51a581])
* Drop support for openSUSE 11
* Upgrade chef-solo-search to v0.4.0
Expand Down Expand Up @@ -47,6 +48,7 @@
* [Łukasz Dubiel][bambuchaAdm]
* [kmdsbng][kmdsbng]
* [Darshan Patil][dapatil]
* [Shin Tokiwa][tocky]

[1]: https://github.com/matschaffer/knife-solo/issues/1
[86]: https://github.com/matschaffer/knife-solo/issues/86
Expand Down Expand Up @@ -77,6 +79,7 @@
[237]: https://github.com/matschaffer/knife-solo/issues/237
[238]: https://github.com/matschaffer/knife-solo/issues/238
[242]: https://github.com/matschaffer/knife-solo/issues/242
[254]: https://github.com/matschaffer/knife-solo/issues/254
[d21756]: https://github.com/matschaffer/knife-solo/commit/d21756
[1d3485]: https://github.com/matschaffer/knife-solo/commit/1d3485
[f43ba4]: https://github.com/matschaffer/knife-solo/commit/f43ba4
Expand Down Expand Up @@ -362,5 +365,6 @@ And a special thanks to [Teemu Matilainen][tmatilai] who is now on the list of d
[smdern]: https://github.com/smdern
[tknerr]: https://github.com/tknerr
[tmatilai]: https://github.com/tmatilai
[tocky]: https://github.com/tocky
[vjpr]: https://github.com/vjpr
[zeph]: https://github.com/zeph
11 changes: 11 additions & 0 deletions lib/chef/knife/solo_cook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ def cookbook_paths
@cookbook_paths ||= expanded_config_paths(:cookbook_path) + [patch_cookbooks_path]
end

def proxy_setting_keys
[:http_proxy, :https_proxy, :http_proxy_user, :http_proxy_pass, :no_proxy]
end

def proxy_settings
proxy_setting_keys.inject(Hash.new) do |ret, key|
ret[key] = Chef::Config[key] if Chef::Config[key]
ret
end
end

def add_cookbook_path(path)
path = expand_path path
cookbook_paths.unshift(path) unless cookbook_paths.include?(path)
Expand Down
4 changes: 4 additions & 0 deletions lib/knife-solo/resources/solo.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ cookbook_path []
<% cookbook_paths.each_with_index do |path, i| -%>
cookbook_path << File.join(base, 'cookbooks-<%= i+1 %>') # <%= path %>
<% end -%>

<% proxy_settings.each_pair do |k, v| -%>
<%= k %> "<%= v %>"
<% end -%>
7 changes: 7 additions & 0 deletions test/solo_cook_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ def test_add_cookbook_path_prepends_the_path
assert_equal "/some/other/path", cmd.cookbook_paths[2].to_s
end

def test_sets_proxy_settings
Chef::Config[:http_proxy] = "http://proxy:3128"
Chef::Config[:no_proxy] = nil
conf = command.proxy_settings
assert_equal({ :http_proxy => "http://proxy:3128" }, conf)
end

def test_does_not_run_berkshelf_if_no_berkfile
in_kitchen do
Berkshelf::Berksfile.any_instance.expects(:install).never
Expand Down

0 comments on commit 58a68f6

Please sign in to comment.