From abc81f3855cacc787507c332670bcdd2dd6eed6d Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 21 Jun 2017 18:18:22 +0100 Subject: [PATCH] snapshot --- lib/puppet/provider/apt_key/apt_key2.rb | 8 +- lib/puppet_x/apt_key/resource_api.rb | 10 +- spec/acceptance/apt_key_provider_spec.rb | 60 ++--- spec/unit/puppet/type/apt_key_spec.rb | 297 ++++++++++++----------- 4 files changed, 196 insertions(+), 179 deletions(-) diff --git a/lib/puppet/provider/apt_key/apt_key2.rb b/lib/puppet/provider/apt_key/apt_key2.rb index ae7200a..9811e5c 100644 --- a/lib/puppet/provider/apt_key/apt_key2.rb +++ b/lib/puppet/provider/apt_key/apt_key2.rb @@ -17,8 +17,12 @@ register_provider('apt_key2') do commands gpg: '/usr/bin/gpg' def canonicalize(resources) - resources.collect do |r| - r[:id] = r[:id].upcase + resources.each do |r| + r[:id] = if r[:id].start_with?('0x') + r[:id][2..-1].upcase + else + r[:id].upcase + end end end diff --git a/lib/puppet_x/apt_key/resource_api.rb b/lib/puppet_x/apt_key/resource_api.rb index b947528..8aa737e 100644 --- a/lib/puppet_x/apt_key/resource_api.rb +++ b/lib/puppet_x/apt_key/resource_api.rb @@ -1,5 +1,4 @@ require 'pathname' -require 'pry' module Puppet::SimpleResource class TypeShim @@ -52,6 +51,15 @@ def register_type(definition) has_namevar = false namevar_name = nil + def initialize(attributes) + $stderr.puts "A: #{attributes.inspect}" + attributes = attributes.to_hash if attributes.is_a? Puppet::Resource + $stderr.puts "B: #{attributes.inspect}" + attributes = self.class.canonicalize([attributes])[0] + $stderr.puts "C: #{attributes.inspect}" + super(attributes) + end + definition[:attributes].each do |name, options| # puts "#{name}: #{options.inspect}" diff --git a/spec/acceptance/apt_key_provider_spec.rb b/spec/acceptance/apt_key_provider_spec.rb index b4347e1..3893a71 100644 --- a/spec/acceptance/apt_key_provider_spec.rb +++ b/spec/acceptance/apt_key_provider_spec.rb @@ -21,7 +21,8 @@ MAX_TIMEOUT_RETRY = 3 TIMEOUT_RETRY_WAIT = 5 TIMEOUT_ERROR_MATCHER = /no valid OpenPGP data found/ -describe 'apt_key' do +%w[apt_key apt_key2].each do |typename| +describe typename do before(:each) do # Delete twice to make sure everything is cleaned # up after the short key collision @@ -51,7 +52,7 @@ describe 'apt_key' do context "#{key}" do it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{value}', ensure => 'present', } @@ -67,7 +68,7 @@ describe 'apt_key' do context 'invalid length key id' do it 'fails' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '8280EF8D349F', } EOS @@ -83,7 +84,7 @@ describe 'apt_key' do context 'absent' do it 'is removed' do pp = <<-EOS - apt_key { 'centos': + #{typename} { 'centos': id => '#{CENTOS_GPG_KEY_LONG_ID}', ensure => 'absent', } @@ -114,7 +115,7 @@ describe 'apt_key' do context 'absent, added with long key', :unless => (fact('operatingsystem') == 'Debian' and fact('operatingsystemmajrelease') == '6') do it 'is removed' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'absent', } @@ -142,7 +143,7 @@ describe 'apt_key' do context 'puppetlabs gpg key' do it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_FINGERPRINT}', ensure => 'present', content => "-----BEGIN PGP PUBLIC KEY BLOCK----- @@ -214,7 +215,7 @@ zGioYMWgVePywFGaTV51/0uF9ymHHC7BDIcLgUWHdg/1B67jR5YQfzPJUqLhnylt context 'multiple keys' do it 'runs without errors' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_FINGERPRINT}', ensure => 'present', content => "-----BEGIN PGP PUBLIC KEY BLOCK----- @@ -475,7 +476,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'bogus key' do it 'fails' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', content => 'For posterity: such content, much bogus, wow', @@ -493,7 +494,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'hkps.pool.sks-keyservers.net' do it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', server => 'hkps.pool.sks-keyservers.net', @@ -513,7 +514,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'hkp://hkps.pool.sks-keyservers.net:80' do it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_FINGERPRINT}', ensure => 'present', server => 'hkp://hkps.pool.sks-keyservers.net:80', @@ -532,7 +533,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'nonexistant.key.server' do it 'fails' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', server => 'nonexistant.key.server', @@ -548,7 +549,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'key server start with dot' do it 'fails' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', server => '.pgp.key.server', @@ -566,7 +567,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'http://' do it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', source => 'http://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}', @@ -580,7 +581,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'works with userinfo' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', source => 'http://dummyuser:dummypassword@#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}', @@ -594,7 +595,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'fails with a 404' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', source => 'http://#{PUPPETLABS_APT_URL}/herpderp.gpg', @@ -608,7 +609,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'fails with a socket error' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', source => 'http://apt.puppetlabss.com/herpderp.gpg', @@ -629,7 +630,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'works' do pp = <<-EOS - apt_key { 'CentOS 6': + #{typename} { 'CentOS 6': id => '#{CENTOS_GPG_KEY_LONG_ID}', ensure => 'present', source => 'ftp://#{CENTOS_REPO_URL}/#{CENTOS_GPG_KEY_FILE}', @@ -643,7 +644,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'fails with a 550' do pp = <<-EOS - apt_key { 'CentOS 6': + #{typename} { 'CentOS 6': id => '#{SHOULD_NEVER_EXIST_ID}', ensure => 'present', source => 'ftp://#{CENTOS_REPO_URL}/herpderp.gpg', @@ -657,7 +658,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'fails with a socket error' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', source => 'ftp://apt.puppetlabss.com/herpderp.gpg', @@ -673,7 +674,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'https://' do it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', source => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}', @@ -687,7 +688,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'works with userinfo' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', source => 'https://dummyuser:dummypassword@#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}', @@ -701,7 +702,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'fails with a 404' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{SHOULD_NEVER_EXIST_ID}', ensure => 'present', source => 'https://#{PUPPETLABS_APT_URL}/herpderp.gpg', @@ -715,7 +716,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'fails with a socket error' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{SHOULD_NEVER_EXIST_ID}', ensure => 'present', source => 'https://apt.puppetlabss.com/herpderp.gpg', @@ -740,7 +741,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => 'EF8D349F', ensure => 'present', source => '/tmp/puppetlabs-pubkey.gpg', @@ -756,7 +757,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context '/path/that/does/not/exist' do it 'fails' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', source => '/tmp/totally_bogus.file', @@ -779,7 +780,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= end it 'fails' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', source => '/tmp/fake-key.gpg', @@ -797,7 +798,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'debug' do it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', ensure => 'present', options => 'debug', @@ -815,7 +816,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'fingerprint in id matches fingerprint from remote key' do it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{typename} { 'puppetlabs': id => '#{PUPPETLABS_GPG_KEY_FINGERPRINT}', ensure => 'present', source => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}', @@ -830,7 +831,7 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= context 'fingerprint in id does NOT match fingerprint from remote key' do it 'works' do pp = <<-EOS - apt_key { 'puppetlabs': + #{} { 'puppetlabs': id => '6F6B15509CF8E59E6E469F327F438280EF8D9999', ensure => 'present', source => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}', @@ -845,3 +846,4 @@ FPfZDNCu/TXoqyJk7434jJrcHgPryzrHFBLfEmc= end end +end diff --git a/spec/unit/puppet/type/apt_key_spec.rb b/spec/unit/puppet/type/apt_key_spec.rb index 330b8fa..f06fa0a 100644 --- a/spec/unit/puppet/type/apt_key_spec.rb +++ b/spec/unit/puppet/type/apt_key_spec.rb @@ -2,189 +2,192 @@ require 'spec_helper' require 'puppet' [:apt_key, :apt_key2].each do |typename| - describe Puppet::Type::type(typename) do - context 'only namevar 32bit key id' do - let(:resource) { Puppet::Type.type(typename).new( - :id => 'EF8D349F' - )} - it 'id is set' do - expect(resource[:id]).to eq 'EF8D349F' - end +describe Puppet::Type::type(typename) do + context 'only namevar 32bit key id' do + let(:resource) { Puppet::Type.type(typename).new( + :id => 'EF8D349F' + )} + it 'id is set' do + expect(resource[:id]).to eq 'EF8D349F' + end - it 'name is set to id' do - expect(resource[:name]).to eq 'EF8D349F' - end + it 'name is set to id' do + expect(resource[:name]).to eq 'EF8D349F' + end - it 'keyserver is default' do - expect(resource[:server]).to eq :'keyserver.ubuntu.com' - end + it 'keyserver is default' do + expect(resource[:server]).to eq :'keyserver.ubuntu.com' + end - it 'source is not set' do - expect(resource[:source]).to eq nil - end + it 'source is not set' do + expect(resource[:source]).to eq nil + end - it 'content is not set' do - expect(resource[:content]).to eq nil - end + it 'content is not set' do + expect(resource[:content]).to eq nil end + end - context 'with a lowercase 32bit key id' do - let(:resource) { Puppet::Type.type(typename).new( - :id => 'ef8d349f' - )} - it 'id is set' do - expect(resource[:id]).to eq 'EF8D349F' - end + context 'with a lowercase 32bit key id' do + let(:resource) { Puppet::Type.type(typename).new( + :id => 'ef8d349f' + )} + it 'id is set' do + expect(resource[:id]).to eq 'EF8D349F' end + end - context 'with a 64bit key id' do - let(:resource) { Puppet::Type.type(typename).new( - :id => 'FFFFFFFFEF8D349F' - )} - it 'id is set' do - expect(resource[:id]).to eq 'FFFFFFFFEF8D349F' - end + context 'with a 64bit key id' do + let(:resource) { Puppet::Type.type(typename).new( + :id => 'FFFFFFFFEF8D349F' + )} + it 'id is set' do + expect(resource[:id]).to eq 'FFFFFFFFEF8D349F' end + end - context 'with a 0x formatted key id' do - let(:resource) { Puppet::Type.type(typename).new( - :id => '0xEF8D349F' - )} - it 'id is set' do - expect(resource[:id]).to eq 'EF8D349F' - end + context 'with a 0x formatted key id' do + let(:resource) { Puppet::Type.type(typename).new( + :id => '0xEF8D349F' + )} + it 'id is set' do + expect(resource[:id]).to eq 'EF8D349F' end + end - context 'with a 0x formatted lowercase key id' do - let(:resource) { Puppet::Type.type(typename).new( - :id => '0xef8d349f' - )} - it 'id is set' do - expect(resource[:id]).to eq 'EF8D349F' - end + context 'with a 0x formatted lowercase key id' do + let(:resource) { Puppet::Type.type(typename).new( + :id => '0xef8d349f' + )} + it 'id is set' do + expect(resource[:id]).to eq 'EF8D349F' end + end - context 'with a 0x formatted 64bit key id' do - let(:resource) { Puppet::Type.type(typename).new( - :id => '0xFFFFFFFFEF8D349F' - )} - it 'id is set' do - expect(resource[:id]).to eq 'FFFFFFFFEF8D349F' - end + context 'with a 0x formatted 64bit key id' do + let(:resource) { Puppet::Type.type(typename).new( + :id => '0xFFFFFFFFEF8D349F' + )} + it 'id is set' do + expect(resource[:id]).to eq 'FFFFFFFFEF8D349F' end + end - context 'with source' do - let(:resource) { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :source => 'http://apt.puppetlabs.com/pubkey.gpg' - )} + context 'with source' do + let(:resource) { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :source => 'http://apt.puppetlabs.com/pubkey.gpg' + )} - it 'source is set to the URL' do - expect(resource[:source]).to eq 'http://apt.puppetlabs.com/pubkey.gpg' - end + it 'source is set to the URL' do + expect(resource[:source]).to eq 'http://apt.puppetlabs.com/pubkey.gpg' end + end - context 'with content' do - let(:resource) { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :content => 'http://apt.puppetlabs.com/pubkey.gpg' - )} + context 'with content' do + let(:resource) { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :content => 'http://apt.puppetlabs.com/pubkey.gpg' + )} - it 'content is set to the string' do - expect(resource[:content]).to eq 'http://apt.puppetlabs.com/pubkey.gpg' - end + it 'content is set to the string' do + expect(resource[:content]).to eq 'http://apt.puppetlabs.com/pubkey.gpg' end + end - context 'with keyserver' do - let(:resource) { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :server => 'http://keyring.debian.org' - )} + context 'with keyserver' do + let(:resource) { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :server => 'http://keyring.debian.org' + )} - it 'keyserver is set to Debian' do - expect(resource[:server]).to eq 'http://keyring.debian.org' - end + it 'keyserver is set to Debian' do + expect(resource[:server]).to eq 'http://keyring.debian.org' end + end - context 'validation' do - it 'raises an error if content and source are set' do - expect { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :source => 'http://apt.puppetlabs.com/pubkey.gpg', - :content => 'Completely invalid as a GPG key' - )}.to raise_error(/content and source are mutually exclusive/) - end - - it 'raises an error if a weird length key is used' do - expect { Puppet::Type.type(typename).new( - :id => 'FEF8D349F', - :source => 'http://apt.puppetlabs.com/pubkey.gpg', - :content => 'Completely invalid as a GPG key' - )}.to raise_error(/Valid values match/) + context 'validation' do + it 'raises an error if content and source are set' do + if typename == :apt_key2 + pending "cross-property validation moved completely to the provider" end + expect { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :source => 'http://apt.puppetlabs.com/pubkey.gpg', + :content => 'Completely invalid as a GPG key' + )}.to raise_error(/content and source are mutually exclusive/) + end - it 'raises an error when an invalid URI scheme is used in source' do - expect { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :source => 'hkp://pgp.mit.edu' - )}.to raise_error(/Valid values match/) - end + it 'raises an error if a weird length key is used' do + expect { Puppet::Type.type(typename).new( + :id => 'FEF8D349F', + :source => 'http://apt.puppetlabs.com/pubkey.gpg', + :content => 'Completely invalid as a GPG key' + )}.to raise_error(/Valid values match/) + end - it 'allows the http URI scheme in source' do - expect { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :source => 'http://pgp.mit.edu' - )}.to_not raise_error - end + it 'raises an error when an invalid URI scheme is used in source' do + expect { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :source => 'hkp://pgp.mit.edu' + )}.to raise_error(/Valid values match/) + end - it 'allows the http URI with username and password' do - expect { Puppet::Type.type(typename).new( - :id => '4BD6EC30', - :source => 'http://testme:Password2@pgp.mit.edu' - )}.to_not raise_error - end + it 'allows the http URI scheme in source' do + expect { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :source => 'http://pgp.mit.edu' + )}.to_not raise_error + end - it 'allows the https URI scheme in source' do - expect { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :source => 'https://pgp.mit.edu' - )}.to_not raise_error - end + it 'allows the http URI with username and password' do + expect { Puppet::Type.type(typename).new( + :id => '4BD6EC30', + :source => 'http://testme:Password2@pgp.mit.edu' + )}.to_not raise_error + end - it 'allows the https URI with username and password' do - expect { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :source => 'https://testme:Password2@pgp.mit.edu' - )}.to_not raise_error - end + it 'allows the https URI scheme in source' do + expect { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :source => 'https://pgp.mit.edu' + )}.to_not raise_error + end - it 'allows the ftp URI scheme in source' do - expect { Puppet::Type.type(typename).new( + it 'allows the https URI with username and password' do + expect { Puppet::Type.type(typename).new( :id => 'EF8D349F', - :source => 'ftp://pgp.mit.edu' - )}.to_not raise_error - end + :source => 'https://testme:Password2@pgp.mit.edu' + )}.to_not raise_error + end - it 'allows an absolute path in source' do - expect { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :source => '/path/to/a/file' - )}.to_not raise_error - end + it 'allows the ftp URI scheme in source' do + expect { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :source => 'ftp://pgp.mit.edu' + )}.to_not raise_error + end - it 'allows 5-digit ports' do - expect { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :source => 'http://pgp.mit.edu:12345/key' - )}.to_not raise_error - end + it 'allows an absolute path in source' do + expect { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :source => '/path/to/a/file' + )}.to_not raise_error + end - it 'allows 5-digit ports when using key servers' do - expect { Puppet::Type.type(typename).new( - :id => 'EF8D349F', - :server => 'http://pgp.mit.edu:12345' - )}.to_not raise_error - end + it 'allows 5-digit ports' do + expect { Puppet::Type.type(typename).new( + :id => 'EF8D349F', + :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(typename).new( + :id => 'EF8D349F', + :server => 'http://pgp.mit.edu:12345' + )}.to_not raise_error end end end +end -- 2.45.2