(MODULES-8081): hkps:// protocol is supported on Ubuntu 18.04 only
authorSimon Deziel <simon@sdeziel.info>
Thu, 18 Oct 2018 20:44:17 +0000 (16:44 -0400)
committerSimon Deziel <simon@sdeziel.info>
Thu, 18 Oct 2018 20:44:17 +0000 (16:44 -0400)
REFERENCE.md
spec/acceptance/apt_key_provider_spec.rb

index be2e9810babacc5a760af9d8b936f71e36da8731..081866dcd89c67be39c737977c75bae1748030ca 100644 (file)
@@ -66,7 +66,7 @@ Default value: $apt::params::provider
 Data type: `String`
 
 Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://,
-hkp:// or hkps://).
+hkp:// or hkps://). The hkps:// protocol is currently only supported on Ubuntu 18.04.
 
 Default value: $apt::params::keyserver
 
@@ -484,7 +484,7 @@ Default value: `undef`
 Data type: `Pattern[/\A((hkp|hkps|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$/]`
 
 Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://,
-hkp:// or hkps://).
+hkp:// or hkps://). The hkps:// protocol is currently only supported on Ubuntu 18.04.
 
 Default value: $::apt::keyserver
 
index c17a11440e83dfd3a6694fadd768a308a5737203..b43dc15f6d59d9d0ed6386f09e801ecee000fed3 100644 (file)
@@ -478,13 +478,21 @@ hkp_pool_pp = <<-MANIFEST
         }
   MANIFEST
 
-hkps_ubuntu_pp = <<-MANIFEST
-        apt_key { 'puppetlabs':
-          id     => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
-          ensure => 'present',
-         server => 'hkps://keyserver.ubuntu.com',
-        }
-  MANIFEST
+if fact('operatingsystem') =~ %r{Ubuntu} and fact('operatingsystemrelease') =~ %r{^18\.04}
+  hkps_protocol_supported = true
+else
+  hkps_protocol_supported = false
+end
+
+if hkps_protocol_supported
+  hkps_ubuntu_pp = <<-MANIFEST
+          apt_key { 'puppetlabs':
+            id     => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
+            ensure => 'present',
+            server => 'hkps://keyserver.ubuntu.com',
+          }
+    MANIFEST
+end
 
 nonexistant_key_server_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -794,14 +802,16 @@ describe 'apt_key' do
       end
     end
 
-    context 'with hkps://keyserver.ubuntu.com' do
-      it 'works' do
-        retry_on_error_matching do
-          apply_manifest(hkps_ubuntu_pp, catch_failures: true)
-        end
+    if hkps_protocol_supported
+      context 'with hkps://keyserver.ubuntu.com' do
+        it 'works' do
+          retry_on_error_matching do
+            apply_manifest(hkps_ubuntu_pp, catch_failures: true)
+          end
 
-        apply_manifest(hkps_ubuntu_pp, catch_changes: true)
-        shell(PUPPETLABS_KEY_CHECK_COMMAND)
+          apply_manifest(hkps_ubuntu_pp, catch_changes: true)
+          shell(PUPPETLABS_KEY_CHECK_COMMAND)
+        end
       end
     end