Allow ports that consist of 5 decimals
authorSimon Kohlmeyer <simon.kohlmeyer@gmail.com>
Fri, 26 Dec 2014 04:10:52 +0000 (05:10 +0100)
committerSimon Kohlmeyer <simon.kohlmeyer@gmail.com>
Thu, 8 Jan 2015 04:26:53 +0000 (05:26 +0100)
lib/puppet/type/apt_key.rb
manifests/key.pp
spec/unit/puppet/type/apt_key_spec.rb

index f55247314cc6f650bab39dd13735bcdda3b9dc3e..8aa408193c802b8f9dcdd41d8602f3eaa0898a38 100644 (file)
@@ -59,7 +59,7 @@ Puppet::Type.newtype(:apt_key) do
     desc 'The key server to fetch the key from based on the ID. It can either be a domain name or url.'
     defaultto :'keyserver.ubuntu.com'
     
-    newvalues(/\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,4})?$/)
+    newvalues(/\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$/)
   end
 
   newparam(:keyserver_options) do
index 8d3bcf045c58f59df310046853e646b0c538191a..c51f4bfa562d4bf7f0d93f63723b927e03010a84 100644 (file)
@@ -69,7 +69,7 @@ define apt::key (
   }
 
   if $key_server {
-    validate_re($key_server,['\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,4})?$'])
+    validate_re($key_server,['\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$'])
   }
 
   if $key_options {
index 57aeb863f862c26fd90f8356012495a20c687edb..e8a5462c6f3e91c002a208883fd4f3116344c66b 100644 (file)
@@ -163,5 +163,19 @@ describe Puppet::Type::type(:apt_key) do
         :source  => '/path/to/a/file'
       )}.to_not raise_error
     end
+
+    it 'allows 5-digit ports' do
+      expect { Puppet::Type.type(:apt_key).new(
+        :id      => '4BD6EC30',
+        :source  => 'http://pgp.mit.edu:12345/key'
+      )}.to_not raise_error
+    end
+
+    it 'allows 5-digit ports when using key servers' do
+      expect { Puppet::Type.type(:apt_key).new(
+        :id      => '4BD6EC30',
+        :server  => 'http://pgp.mit.edu:12345'
+      )}.to_not raise_error
+    end
   end
 end