]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Merge pull request #385 from phervieux/utopic
authorMorgan Haskel <morgan@puppetlabs.com>
Thu, 4 Dec 2014 22:42:42 +0000 (17:42 -0500)
committerMorgan Haskel <morgan@puppetlabs.com>
Thu, 4 Dec 2014 22:42:42 +0000 (17:42 -0500)
Add utopic support

lib/puppet/provider/apt_key/apt_key.rb
metadata.json
spec/unit/puppet/type/apt_key_spec.rb

index 3ef94315089634cb75eb5f8cefa8886be20e09cc..1a7f17cc163fff927c64d30c288ae4fa2d7718aa 100644 (file)
@@ -113,12 +113,13 @@ Puppet::Type.type(:apt_key).provide(:apt_key) do
   end
 
   def source_to_file(value)
-    if URI::parse(value).scheme.nil?
+    parsedValue = URI::parse(value)
+    if parsedValue.scheme.nil?
       fail("The file #{value} does not exist") unless File.exists?(value)
       value
     else
       begin
-        key = open(value, :ftp_active_mode => false).read
+        key = parsedValue.read
       rescue OpenURI::HTTPError, Net::FTPPermError => e
         fail("#{e.message} for #{resource[:source]}")
       rescue SocketError
@@ -163,6 +164,7 @@ Puppet::Type.type(:apt_key).provide(:apt_key) do
   end
 
   def destroy
+    #Currently del only removes the first key, we need to recursively list and ensure all with id are absent.
     apt_key('del', resource[:id])
     @property_hash.clear
   end
index a92b8a7bf646fd9d59b355e2a6e5a38b19c749c7..4c0e3d8c6a844dbc603511e113569bf4d6ee9b25 100644 (file)
@@ -2,7 +2,7 @@
   "name": "puppetlabs-apt",
   "version": "1.7.0",
   "author": "Puppet Labs",
-  "summary": "Puppet Labs Apt Module",
+  "summary": "Provides an interface for managing Apt source, key, and definitions with Puppet",
   "license": "Apache-2.0",
   "source": "https://github.com/puppetlabs/puppetlabs-apt",
   "project_page": "https://github.com/puppetlabs/puppetlabs-apt",
index e661ba1bdbb5ea8ee1a809a36ac70dbac48846e7..57aeb863f862c26fd90f8356012495a20c687edb 100644 (file)
@@ -82,7 +82,7 @@ describe Puppet::Type::type(:apt_key) do
       resource[:source].should eq 'http://apt.puppetlabs.com/pubkey.gpg'
     end
   end
-  
+
   context 'with content' do
     let(:resource) { Puppet::Type.type(:apt_key).new(
       :id => '4BD6EC30',
@@ -93,7 +93,7 @@ describe Puppet::Type::type(:apt_key) do
       resource[:content].should eq 'http://apt.puppetlabs.com/pubkey.gpg'
     end
   end
-  
+
   context 'with keyserver' do
     let(:resource) { Puppet::Type.type(:apt_key).new(
       :id => '4BD6EC30',
@@ -143,6 +143,13 @@ describe Puppet::Type::type(:apt_key) do
       )}.to_not raise_error
     end
 
+    it 'allows the https URI with username and password' do
+      expect { Puppet::Type.type(:apt_key).new(
+          :id      => '4BD6EC30',
+          :source  => 'https://testme:Password2@pgp.mit.edu'
+      )}.to_not raise_error
+    end
+
     it 'allows the ftp URI scheme in source' do
       expect { Puppet::Type.type(:apt_key).new(
         :id      => '4BD6EC30',