Allow ports that consist of 5 decimals

This commit is contained in:
Simon Kohlmeyer 2014-12-26 05:10:52 +01:00
parent 2873c1e2e7
commit b0e0024730
No known key found for this signature in database
GPG key ID: C0F40038CBE9B92E
3 changed files with 16 additions and 2 deletions

View 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

View 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 {

View 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