From a375b3715352d405505a47af5fa141dd92e1f034 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Wed, 26 Nov 2014 22:08:17 -0800 Subject: [PATCH] fix gem install failure for ubuntu chef-client gem install does not honor .gemrc in time, so specify the http-proxy option explicitly. moreover, post-apt-config kickstart file has a syntax error, which is also fixed in the patch. Change-Id: Iadf78b6c0aff691e3f6824c20e906b75b681e848 Closes-bug: #1393967 Closes-bug: #1396948 --- chef/cookbooks/mysql/recipes/ruby.rb | 11 ++++++++++- cobbler/snippets/preseed_post_apt_repo_config | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/chef/cookbooks/mysql/recipes/ruby.rb b/chef/cookbooks/mysql/recipes/ruby.rb index 9f0d9ad..2258244 100644 --- a/chef/cookbooks/mysql/recipes/ruby.rb +++ b/chef/cookbooks/mysql/recipes/ruby.rb @@ -44,8 +44,17 @@ node['mysql']['client']['packages'].each do |name| resources("package[#{name}]").run_action(:install) end +# unknown reason cause chef-client not to honor .gemrc immediately +# even not until timeout is reached, so specify the options explicitly. if node['local_repo'].nil? or node['local_repo'].empty? - chef_gem 'mysql' + if node['proxy_url'] + gem_package 'mysql' do + options("--http-proxy #{node['proxy_url']}") + action :install + end + else + chef_gem 'mysql' + end else gem_package 'mysql' do options("--clear-sources --source #{node['local_repo']}/gem_repo/") diff --git a/cobbler/snippets/preseed_post_apt_repo_config b/cobbler/snippets/preseed_post_apt_repo_config index eb509b9..2a92ae8 100644 --- a/cobbler/snippets/preseed_post_apt_repo_config +++ b/cobbler/snippets/preseed_post_apt_repo_config @@ -1,6 +1,6 @@ cat << EOF > /etc/apt/apt.conf #if $getVar('proxy', '') != '' -Acquire::http::Proxy "$proxy" +Acquire::http::Proxy "$proxy"; #end if EOF