lib/chef/provisioning/convergence_strategy/install_sh.rb in chef-provisioning-1.0.1 vs lib/chef/provisioning/convergence_strategy/install_sh.rb in chef-provisioning-1.1.0

- old
+ new

@@ -62,10 +62,23 @@ end end # Install chef client # TODO ssh verification of install.sh before running arbtrary code would be nice? - @@install_sh_cache[install_sh_url] ||= Net::HTTP.get(URI(install_sh_url)) + if convergence_options[:bootstrap_proxy].empty? + @@install_sh_cache[install_sh_url] ||= Net::HTTP.get(URI(install_sh_url)) + else + @@install_sh_cache[install_sh_url] ||= begin + proxy_uri = URI.parse(convergence_options[:bootstrap_proxy]) + chef_uri = URI.parse(@install_sh_url) + proxy = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password) + req = Net::HTTP::Get.new(chef_uri.path) + script = proxy.start(chef_uri.host, :use_ssl => proxy_uri.scheme == 'https') do |http| + http.request(req) + end + script.body + end + end machine.write_file(action_handler, install_sh_path, @@install_sh_cache[install_sh_url], :ensure_dir => true) # TODO handle bad version case better machine.execute(action_handler, install_sh_command_line) end