Skip to content

Commit

Permalink
Merge pull request #154 from Rockstar04/master
Browse files Browse the repository at this point in the history
Update repository.rb
  • Loading branch information
thommay committed Aug 18, 2015
2 parents bffaa41 + 0cdaace commit cd7c579
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion providers/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def whyrun_supported?
# install apt key from keyserver
def install_key_from_keyserver(key, keyserver, key_proxy)
execute "install-key #{key}" do
if key_proxy.empty?
if keyserver.start_with?('hkp://')
command "apt-key adv --keyserver #{keyserver} --recv #{key}"
elsif key_proxy.empty?
command "apt-key adv --keyserver hkp://#{keyserver}:80 --recv #{key}"
else
command "apt-key adv --keyserver-options http-proxy=#{key_proxy} --keyserver hkp://#{keyserver}:80 --recv #{key}"
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/cookbooks/apt_test/recipes/lwrps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
action :add
end

# Apt Repository
apt_repository 'nodejs' do
uri 'http://ppa.launchpad.net/chris-lea/node.js/ubuntu'
components ['main']
distribution 'trusty'
key 'C7917B12'
keyserver 'hkp://keyserver.ubuntu.com:80'
action :add
end

# PPA Repository
apt_repository 'rust' do
uri 'ppa:hansjorg/rust'
Expand Down
4 changes: 4 additions & 0 deletions test/integration/lwrps/serverspec/lwrps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
expect(file('/etc/apt/sources.list.d/juju.list')).to exist
end

it 'creates the NodeJS sources.list' do
expect(file('/etc/apt/sources.list.d/nodejs.list')).to exist
end

it 'creates a repo with a url that is already quoted' do
src = 'deb\s+\"http://ppa.launchpad.net/juju/stable/ubuntu\" trusty main'
expect(file('/etc/apt/sources.list.d/juju.list').content).to match(/#{src}/)
Expand Down

0 comments on commit cd7c579

Please sign in to comment.