diff --git a/Rakefile b/Rakefile index a0d39a170..a90efcec8 100644 --- a/Rakefile +++ b/Rakefile @@ -20,8 +20,8 @@ task :gen_nodeset do agent_target = ENV['TEST_TARGET'] if ! agent_target STDERR.puts 'TEST_TARGET environment variable is not set' - STDERR.puts 'setting to default value of "redhat-64default."' - agent_target = 'redhat-64default.' + STDERR.puts 'setting to default value of "redhat7-64default.a"' + agent_target = 'redhat7-64default.a' end master_target = ENV['MASTER_TEST_TARGET'] diff --git a/files/RPM-GPG-KEY-puppet b/files/GPG-KEY-puppet similarity index 100% rename from files/RPM-GPG-KEY-puppet rename to files/GPG-KEY-puppet diff --git a/files/RPM-GPG-KEY-puppetlabs b/files/GPG-KEY-puppetlabs similarity index 100% rename from files/RPM-GPG-KEY-puppetlabs rename to files/GPG-KEY-puppetlabs diff --git a/manifests/osfamily/debian.pp b/manifests/osfamily/debian.pp index 58c3efc3a..5e7ecb88f 100644 --- a/manifests/osfamily/debian.pp +++ b/manifests/osfamily/debian.pp @@ -79,9 +79,34 @@ } } + $legacy_keyname = 'GPG-KEY-puppetlabs' + $legacy_gpg_path = "/etc/pki/deb-gpg/${legacy_keyname}" + $keyname = 'GPG-KEY-puppet' + $gpg_path = "/etc/pki/deb-gpg/${keyname}" + + file { ['/etc/pki', '/etc/pki/deb-gpg']: + ensure => directory, + } + + file { $legacy_gpg_path: + ensure => present, + owner => 0, + group => 0, + mode => '0644', + source => "puppet:///modules/puppet_agent/${legacy_keyname}", + } + apt::key { 'legacy key': id => '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30', - server => 'pgp.mit.edu', + source => $legacy_gpg_path, + } + + file { $gpg_path: + ensure => present, + owner => 0, + group => 0, + mode => '0644', + source => "puppet:///modules/puppet_agent/${keyname}", } apt::source { 'pc_repo': @@ -89,7 +114,7 @@ repos => $::puppet_agent::collection, key => { 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', - 'server' => 'pgp.mit.edu', + 'source' => $gpg_path, }, notify => Notify['pc_repo_force'], } diff --git a/manifests/osfamily/redhat.pp b/manifests/osfamily/redhat.pp index 4aea2369a..5dd658b6b 100644 --- a/manifests/osfamily/redhat.pp +++ b/manifests/osfamily/redhat.pp @@ -48,10 +48,10 @@ } } - $legacy_keyname = 'RPM-GPG-KEY-puppetlabs' - $legacy_gpg_path = "/etc/pki/rpm-gpg/${legacy_keyname}" - $keyname = 'RPM-GPG-KEY-puppet' - $gpg_path = "/etc/pki/rpm-gpg/${keyname}" + $legacy_keyname = 'GPG-KEY-puppetlabs' + $legacy_gpg_path = "/etc/pki/rpm-gpg/RPM-${legacy_keyname}" + $keyname = 'GPG-KEY-puppet' + $gpg_path = "/etc/pki/rpm-gpg/RPM-${keyname}" $gpg_keys = "file://${legacy_gpg_path} file://${gpg_path}" diff --git a/spec/classes/puppet_agent_osfamily_debian_spec.rb b/spec/classes/puppet_agent_osfamily_debian_spec.rb index 226b4c15a..308c13d9c 100644 --- a/spec/classes/puppet_agent_osfamily_debian_spec.rb +++ b/spec/classes/puppet_agent_osfamily_debian_spec.rb @@ -146,9 +146,25 @@ 'content' => apt_settings.join(''), }) } + it { is_expected.to contain_file('/etc/pki/deb-gpg/GPG-KEY-puppetlabs').with({ + 'ensure' => 'present', + 'owner' => '0', + 'group' => '0', + 'mode' => '0644', + 'source' => 'puppet:///modules/puppet_agent/GPG-KEY-puppetlabs', + }) } + + it { is_expected.to contain_file('/etc/pki/deb-gpg/GPG-KEY-puppet').with({ + 'ensure' => 'present', + 'owner' => '0', + 'group' => '0', + 'mode' => '0644', + 'source' => 'puppet:///modules/puppet_agent/GPG-KEY-puppet', + }) } + it { is_expected.to contain_apt__key('legacy key').with({ 'id' => '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30', - 'server' => 'pgp.mit.edu', + 'source' => '/etc/pki/deb-gpg/GPG-KEY-puppetlabs', }) } it { is_expected.to contain_apt__source('pc_repo').with({ @@ -156,7 +172,7 @@ 'repos' => 'PC1', 'key' => { 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', - 'server' => 'pgp.mit.edu', + 'source' => '/etc/pki/deb-gpg/GPG-KEY-puppet', }, }) } end @@ -193,7 +209,7 @@ it { is_expected.to contain_apt__key('legacy key').with({ 'id' => '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30', - 'server' => 'pgp.mit.edu', + 'source' => '/etc/pki/deb-gpg/GPG-KEY-puppetlabs', }) } it { is_expected.to contain_apt__source('pc_repo').with({ @@ -201,7 +217,7 @@ 'repos' => 'PC1', 'key' => { 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', - 'server' => 'pgp.mit.edu', + 'source' => '/etc/pki/deb-gpg/GPG-KEY-puppet', }, }) } end diff --git a/spec/classes/puppet_agent_osfamily_redhat_spec.rb b/spec/classes/puppet_agent_osfamily_redhat_spec.rb index 3dfa6164a..422a667c6 100644 --- a/spec/classes/puppet_agent_osfamily_redhat_spec.rb +++ b/spec/classes/puppet_agent_osfamily_redhat_spec.rb @@ -20,7 +20,7 @@ :operatingsystemmajrelease => osmajor, }} - it { is_expected.to contain_exec('import-RPM-GPG-KEY-puppetlabs').with({ + it { is_expected.to contain_exec('import-GPG-KEY-puppetlabs').with({ 'path' => '/bin:/usr/bin:/sbin:/usr/sbin', 'command' => 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs', 'unless' => 'rpm -q gpg-pubkey-`echo $(gpg --throw-keyids < /etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs) | cut --characters=11-18 | tr [:upper:] [:lower:]`', @@ -28,7 +28,7 @@ 'logoutput' => 'on_failure', }) } - it { is_expected.to contain_exec('import-RPM-GPG-KEY-puppet').with({ + it { is_expected.to contain_exec('import-GPG-KEY-puppet').with({ 'path' => '/bin:/usr/bin:/sbin:/usr/sbin', 'command' => 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puppet', 'unless' => 'rpm -q gpg-pubkey-`echo $(gpg --throw-keyids < /etc/pki/rpm-gpg/RPM-GPG-KEY-puppet) | cut --characters=11-18 | tr [:upper:] [:lower:]`', @@ -47,7 +47,7 @@ 'owner' => '0', 'group' => '0', 'mode' => '0644', - 'source' => 'puppet:///modules/puppet_agent/RPM-GPG-KEY-puppetlabs', + 'source' => 'puppet:///modules/puppet_agent/GPG-KEY-puppetlabs', }) } it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-puppet').with({ @@ -55,7 +55,7 @@ 'owner' => '0', 'group' => '0', 'mode' => '0644', - 'source' => 'puppet:///modules/puppet_agent/RPM-GPG-KEY-puppet', + 'source' => 'puppet:///modules/puppet_agent/GPG-KEY-puppet', }) } context 'when FOSS and manage_repo enabled' do