From 7649b6b8afd64875e1b41066fd2dfbf8c637cc40 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sat, 28 Oct 2023 18:04:27 +0200 Subject: [PATCH 1/3] switch to using the nodistro nodesource repos the other ones do not contain the latest releases (e.g. 20.x contains 20.5 vs 20.9) --- .../nodesource/NODESOURCE-GPG-SIGNING-KEY-EL | 51 +++---- manifests/init.pp | 2 - manifests/params.pp | 2 - manifests/repo/nodesource.pp | 36 ----- manifests/repo/nodesource/apt.pp | 11 +- manifests/repo/nodesource/yum.pp | 34 +---- spec/classes/nodejs_spec.rb | 139 ++---------------- 7 files changed, 42 insertions(+), 233 deletions(-) diff --git a/files/repo/nodesource/NODESOURCE-GPG-SIGNING-KEY-EL b/files/repo/nodesource/NODESOURCE-GPG-SIGNING-KEY-EL index 6c53eb0d..f385c258 100644 --- a/files/repo/nodesource/NODESOURCE-GPG-SIGNING-KEY-EL +++ b/files/repo/nodesource/NODESOURCE-GPG-SIGNING-KEY-EL @@ -1,29 +1,30 @@ -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1 -mQINBFQCN9QBEADv5QYOlCWNkI/oKST/GGpQkOZjFY2cbYdHuc2j8kyM4oeNluXq -puEYMHOoQvbJ3DFPvsv+jCruL7qjkel9YzaF6e3RN2ystP4YBjxyOT7Bb5EnjNNU -6oScQJ50/+RmA4N3wzBrw5+x5KQGBfRU/k7JdDKO6SGY0zzdAo3jqp1nQ9Sf+Fmg -hsjDLVZTHorLPV3yPLb37QlvBB2YIRF+dL9l4wPAI/fGyWv+Qs7VlCZTyRAnKGbv -qN1LvlYoV9YqxaJYYJW+MQhn4706yNJAFeOZuKejEcnZTd/NBiAR91sVnsXKgW9e -yb4TZ7SqkmrJpuKJBpdPr1dgaK8dDmFh9Nlhpz6xZuYcKaDEDa5b3wymnixtwZf2 -WyboChIlsHDajtXZt34xP9uUge1VHyk1o8AQUzKEpuepxxLnyXArLgvHaLhQnxPA -bQB43b4RbWYHPdB16ki2WoZX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P3ZN/WIbtn5dqxppkV/YkO7GiJlp +Jlju9rf3kKUIQzKQWxFsbCAPIHoWv7rH9RSxgDithXtG6Yg5R1aeBbJaPNXL9wpJ +YBJbiMjkAFaz4B95FOqZm3r7oHugiCGsHX0AEQEAAYkBHwQYAQIACQUCV0M3UAIb +DAAKCRAvWbX5mxvgtE/OB/0VN88DR3Y3fuqy7lq/dthkn7Dqm9YXdorZl3L152eE +IF882aG8FE3qZdaLGjQO4oShAyNWmRfSGuoH0XERXAI9n0r8m4mDMxE6rtP7tHet +y/5M8x3CTyuMgx5GLDaEUvBusnTD+/v/fBMwRK/cZ9du5PSG4R50rtst+oYyC2ao +x4I2SgjtF/cY7bECsZDplzatN3gv34PkcdIg8SLHAVlL4N5tzumDeizRspcSyoy2 +K2+hwKU4C4+dekLLTg8rjnRROvplV2KtaEk6rxKtIRFDCoQng8wfJuIMrDNKvqZw +FRGt7cbvW5MCnuH8MhItOl9Uxp1wHp6gtav/h8Gp6MBa +=MARt -----END PGP PUBLIC KEY BLOCK----- diff --git a/manifests/init.pp b/manifests/init.pp index 15781ea3..33575279 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,14 +15,12 @@ Optional[String] $npmrc_auth = $nodejs::params::npmrc_auth, Optional[Hash] $npmrc_config = $nodejs::params::npmrc_config, $repo_class = $nodejs::params::repo_class, - $repo_enable_src = $nodejs::params::repo_enable_src, $repo_ensure = $nodejs::params::repo_ensure, $repo_pin = $nodejs::params::repo_pin, $repo_priority = $nodejs::params::repo_priority, $repo_proxy = $nodejs::params::repo_proxy, $repo_proxy_password = $nodejs::params::repo_proxy_password, $repo_proxy_username = $nodejs::params::repo_proxy_username, - Optional[String] $repo_release = $nodejs::params::repo_release, String[1] $repo_version = $nodejs::params::repo_version, Array $use_flags = $nodejs::params::use_flags, Optional[String] $package_provider = $nodejs::params::package_provider, diff --git a/manifests/params.pp b/manifests/params.pp index 8fc2bdf8..971cdbaa 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -3,14 +3,12 @@ $npmrc_config = undef $nodejs_debug_package_ensure = 'absent' $nodejs_package_ensure = 'installed' - $repo_enable_src = false $repo_ensure = 'present' $repo_pin = undef $repo_priority = 'absent' $repo_proxy = 'absent' $repo_proxy_password = 'absent' $repo_proxy_username = 'absent' - $repo_release = undef $repo_version = ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7') ? { true => '16', default => '20', diff --git a/manifests/repo/nodesource.pp b/manifests/repo/nodesource.pp index c7409160..3bf7c306 100644 --- a/manifests/repo/nodesource.pp +++ b/manifests/repo/nodesource.pp @@ -1,52 +1,16 @@ # PRIVATE CLASS: Do not use directly class nodejs::repo::nodesource { - $enable_src = $nodejs::repo_enable_src $ensure = $nodejs::repo_ensure $pin = $nodejs::repo_pin $priority = $nodejs::repo_priority $proxy = $nodejs::repo_proxy $proxy_password = $nodejs::repo_proxy_password $proxy_username = $nodejs::repo_proxy_username - $release = $nodejs::repo_release $url_suffix = "${nodejs::repo_version}.x" case $facts['os']['family'] { 'RedHat': { - if $facts['os']['release']['major'] =~ /^[789]$/ { - $dist_version = $facts['os']['release']['major'] - $name_string = "Enterprise Linux ${dist_version}" - } - - # Fedora - elsif $facts['os']['name'] == 'Fedora' { - $dist_version = $facts['os']['release']['full'] - $name_string = "Fedora Core ${facts['os']['release']['full']}" - } - - # newer Amazon Linux releases - elsif ($facts['os']['name'] == 'Amazon') { - $dist_version = '7' - $name_string = 'Enterprise Linux 7' - } - - else { - fail("Could not determine NodeSource repository URL for operatingsystem: ${facts['os']['name']} operatingsystemrelease: ${facts['os']['release']['full']}.") - } - - $dist_type = $facts['os']['name'] ? { - 'Fedora' => 'fc', - default => 'el', - } - - # nodesource repo - $descr = "Node.js Packages for ${name_string} - \$basearch" - $baseurl = "https://rpm.nodesource.com/pub_${url_suffix}/${dist_type}/${dist_version}/\$basearch" - - # nodesource-source repo - $source_descr = "Node.js for ${name_string} - \$basearch - Source" - $source_baseurl = "https://rpm.nodesource.com/pub_${url_suffix}/${dist_type}/${dist_version}/SRPMS" - contain 'nodejs::repo::nodesource::yum' } 'Debian': { diff --git a/manifests/repo/nodesource/apt.pp b/manifests/repo/nodesource/apt.pp index 13528a8a..6b0cded2 100644 --- a/manifests/repo/nodesource/apt.pp +++ b/manifests/repo/nodesource/apt.pp @@ -1,25 +1,20 @@ # PRIVATE CLASS: Do not use directly. class nodejs::repo::nodesource::apt { - $enable_src = $nodejs::repo::nodesource::enable_src $ensure = $nodejs::repo::nodesource::ensure $pin = $nodejs::repo::nodesource::pin - $release = $nodejs::repo::nodesource::release $url_suffix = $nodejs::repo::nodesource::url_suffix include apt if ($ensure != 'absent') { apt::source { 'nodesource': - include => { - 'src' => $enable_src, - }, key => { - 'id' => '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280', - 'source' => 'https://deb.nodesource.com/gpgkey/nodesource.gpg.key', + 'id' => '6F71F525282841EEDAF851B42F59B5F99B1BE0B4', + 'source' => 'https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key', }, location => "https://deb.nodesource.com/node_${url_suffix}", pin => $pin, - release => $release, + release => 'nodistro', repos => 'main', } diff --git a/manifests/repo/nodesource/yum.pp b/manifests/repo/nodesource/yum.pp index be31b8e6..fc4b15b5 100644 --- a/manifests/repo/nodesource/yum.pp +++ b/manifests/repo/nodesource/yum.pp @@ -1,20 +1,11 @@ # PRIVATE CLASS: Do not use directly. class nodejs::repo::nodesource::yum { - $baseurl = $nodejs::repo::nodesource::baseurl - $descr = $nodejs::repo::nodesource::descr - $enable_src = $nodejs::repo::nodesource::enable_src $ensure = $nodejs::repo::nodesource::ensure $priority = $nodejs::repo::nodesource::priority $proxy = $nodejs::repo::nodesource::proxy $proxy_password = $nodejs::repo::nodesource::proxy_password $proxy_username = $nodejs::repo::nodesource::proxy_username - $source_baseurl = $nodejs::repo::nodesource::source_baseurl - $source_descr = $nodejs::repo::nodesource::source_descr - - $yum_source_enabled = $enable_src ? { - true => '1', - default => '0', - } + $url_suffix = $nodejs::repo::nodesource::url_suffix $yum_failovermethod = (versioncmp($facts['os']['release']['major'], '8') >= 0 and $priority == 'absent') ? { true => 'absent', @@ -38,8 +29,8 @@ } yumrepo { 'nodesource': - descr => $descr, - baseurl => $baseurl, + descr => 'Node.js Packages - $basearch', + baseurl => "https://rpm.nodesource.com/pub_${url_suffix}/nodistro/nodejs/\$basearch", enabled => '1', failovermethod => $yum_failovermethod, gpgkey => 'file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL', @@ -52,21 +43,6 @@ require => File['/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL'], } - yumrepo { 'nodesource-source': - descr => $source_descr, - baseurl => $source_baseurl, - enabled => $yum_source_enabled, - failovermethod => $yum_failovermethod, - gpgkey => 'file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL', - gpgcheck => '1', - module_hotfixes => $module_hotfixes, - priority => $priority, - proxy => $proxy, - proxy_password => $proxy_password, - proxy_username => $proxy_username, - require => File['/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL'], - } - file { '/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL': ensure => file, group => '0', @@ -81,10 +57,6 @@ ensure => 'absent', } - yumrepo { 'nodesource-source': - ensure => 'absent', - } - if versioncmp($facts['os']['release']['major'], '8') >= 0 { file { 'dnf_module': ensure => absent, diff --git a/spec/classes/nodejs_spec.rb b/spec/classes/nodejs_spec.rb index 5577fadb..f63b30db 100644 --- a/spec/classes/nodejs_spec.rb +++ b/spec/classes/nodejs_spec.rb @@ -84,26 +84,6 @@ end end - context 'and repo_enable_src set to true' do - let :params do - default_params.merge!(repo_enable_src: true) - end - - it 'the repo apt::source resource should contain include => { src => true}' do - is_expected.to contain_apt__source('nodesource').with('include' => { 'src' => true }) - end - end - - context 'and repo_enable_src set to false' do - let :params do - default_params.merge!(repo_enable_src: false) - end - - it 'the repo apt::source resource should contain include => { src => false}' do - is_expected.to contain_apt__source('nodesource').with('include' => { 'src' => false }) - end - end - context 'and repo_pin set to 10' do let :params do default_params.merge!(repo_pin: '10') @@ -114,16 +94,6 @@ end end - context 'and repo_release set to stretch' do - let :params do - default_params.merge!(repo_release: 'stretch') - end - - it 'the repo apt::source resource should contain release = stretch' do - is_expected.to contain_apt__source('nodesource').with('release' => 'stretch') - end - end - context 'and repo_pin not set' do let :params do default_params.merge!(repo_pin: :undef) @@ -297,11 +267,8 @@ operatingsystemmajrelease = osversions[0] operatingsystem = 'CentOS' - dist_type = 'el' - repo_baseurl = "https://rpm.nodesource.com/pub_16.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch" - repo_source_baseurl = "https://rpm.nodesource.com/pub_16.x/#{dist_type}/#{operatingsystemmajrelease}/SRPMS" - repo_descr = "Node.js Packages for Enterprise Linux #{operatingsystemmajrelease} - $basearch" - repo_source_descr = "Node.js for Enterprise Linux #{operatingsystemmajrelease} - $basearch - Source" + repo_baseurl = 'https://rpm.nodesource.com/pub_16.x/nodistro/nodejs/$basearch' + repo_descr = 'Node.js Packages - $basearch' context "when run on #{operatingsystem} release #{operatingsystemrelease}" do let :facts do @@ -359,66 +326,21 @@ is_expected.to contain_class('nodejs::repo::nodesource::yum') end - it 'the nodesource and nodesource-source repos should contain the right description and baseurl' do + it 'the nodesource repo should contain the right description and baseurl' do is_expected.to contain_yumrepo('nodesource').with( 'baseurl' => repo_baseurl, 'descr' => repo_descr ) - - is_expected.to contain_yumrepo('nodesource-source').with( - 'baseurl' => repo_source_baseurl, - 'descr' => repo_source_descr - ) - end - end - - context 'and repo_version set to 5' do - let :params do - default_params.merge!(repo_version: '5') - end - - it "the yum nodesource repo resource should contain baseurl = https://rpm.nodesource.com/pub_5.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch" do - is_expected.to contain_yumrepo('nodesource').with('baseurl' => "https://rpm.nodesource.com/pub_5.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch") end end - context 'and repo_enable_src set to true' do + context 'and repo_version set to 21' do let :params do - default_params.merge!(repo_enable_src: true) + default_params.merge!(repo_version: '21') end - it 'the yumrepo resource nodesource-source should contain enabled = 1' do - is_expected.to contain_yumrepo('nodesource-source').with('enabled' => '1') - end - end - - context 'and repo_enable_src set to false' do - let :params do - default_params.merge!(repo_enable_src: false) - end - - it 'the yumrepo resource should contain enabled = 0' do - is_expected.to contain_yumrepo('nodesource-source').with('enabled' => '0') - end - end - - context 'and repo_priority set to 50' do - let :params do - default_params.merge!(repo_priority: '50') - end - - it 'the yumrepo resource nodesource-source should contain priority = 50' do - is_expected.to contain_yumrepo('nodesource-source').with('priority' => '50') - end - end - - context 'and repo_priority not set' do - let :params do - default_params.merge!(repo_priority: 'absent') - end - - it 'the yumrepo resource nodesource-source should contain priority = absent' do - is_expected.to contain_yumrepo('nodesource-source').with('priority' => 'absent') + it 'the yum nodesource repo resource should contain baseurl = https://rpm.nodesource.com/pub_21.x/nodistro/nodejs/$basearch' do + is_expected.to contain_yumrepo('nodesource').with('baseurl' => 'https://rpm.nodesource.com/pub_21.x/nodistro/nodejs/$basearch') end end @@ -429,7 +351,6 @@ it 'the nodesource yum repo files should exist' do is_expected.to contain_yumrepo('nodesource') - is_expected.to contain_yumrepo('nodesource-source') end end @@ -440,7 +361,6 @@ it 'the nodesource yum repo files should not exist' do is_expected.to contain_yumrepo('nodesource').with('ensure' => 'absent') - is_expected.to contain_yumrepo('nodesource-source').with('ensure' => 'absent') end end @@ -451,7 +371,6 @@ it 'the yumrepo resource should contain proxy = absent' do is_expected.to contain_yumrepo('nodesource').with('proxy' => 'absent') - is_expected.to contain_yumrepo('nodesource-source').with('proxy' => 'absent') end end @@ -462,7 +381,6 @@ it 'the yumrepo resource should contain proxy = http://proxy.localdomain.com' do is_expected.to contain_yumrepo('nodesource').with('proxy' => 'http://proxy.localdomain.com') - is_expected.to contain_yumrepo('nodesource-source').with('proxy' => 'http://proxy.localdomain.com') end end @@ -473,7 +391,6 @@ it 'the yumrepo resource should contain proxy_password = absent' do is_expected.to contain_yumrepo('nodesource').with('proxy_password' => 'absent') - is_expected.to contain_yumrepo('nodesource-source').with('proxy_password' => 'absent') end end @@ -484,7 +401,6 @@ it 'the yumrepo resource should contain proxy_password = password' do is_expected.to contain_yumrepo('nodesource').with('proxy_password' => 'password') - is_expected.to contain_yumrepo('nodesource-source').with('proxy_password' => 'password') end end @@ -495,7 +411,6 @@ it 'the yumrepo resource should contain proxy_username = absent' do is_expected.to contain_yumrepo('nodesource').with('proxy_username' => 'absent') - is_expected.to contain_yumrepo('nodesource-source').with('proxy_username' => 'absent') end end @@ -506,7 +421,6 @@ it 'the yumrepo resource should contain proxy_username = proxyuser' do is_expected.to contain_yumrepo('nodesource').with('proxy_username' => 'proxyuser') - is_expected.to contain_yumrepo('nodesource-source').with('proxy_username' => 'proxyuser') end end end @@ -1303,10 +1217,8 @@ } end - repo_baseurl = 'https://rpm.nodesource.com/pub_20.x/el/7/$basearch' - repo_source_baseurl = 'https://rpm.nodesource.com/pub_20.x/el/7/SRPMS' - repo_descr = 'Node.js Packages for Enterprise Linux 7 - $basearch' - repo_source_descr = 'Node.js for Enterprise Linux 7 - $basearch - Source' + repo_baseurl = 'https://rpm.nodesource.com/pub_20.x/nodistro/nodejs/$basearch' + repo_descr = 'Node.js Packages - $basearch' # manage_package_repo context 'with manage_package_repo set to true' do @@ -1350,32 +1262,9 @@ is_expected.to contain_class('nodejs::repo::nodesource::yum') end - it 'the nodesource and nodesource-source repos should contain the right description and baseurl' do + it 'the nodesource repo should contain the right description and baseurl' do is_expected.to contain_yumrepo('nodesource').with('baseurl' => repo_baseurl, 'descr' => repo_descr) - - is_expected.to contain_yumrepo('nodesource-source').with('baseurl' => repo_source_baseurl, - 'descr' => repo_source_descr) - end - end - - context 'and repo_enable_src set to true' do - let :params do - default_params.merge!(repo_enable_src: true) - end - - it 'the yumrepo resource nodesource-source should contain enabled = 1' do - is_expected.to contain_yumrepo('nodesource-source').with('enabled' => '1') - end - end - - context 'and repo_enable_src set to false' do - let :params do - default_params.merge!(repo_enable_src: false) - end - - it 'the yumrepo resource should contain enabled = 0' do - is_expected.to contain_yumrepo('nodesource-source').with('enabled' => '0') end end @@ -1386,7 +1275,6 @@ it 'the nodesource yum repo files should exist' do is_expected.to contain_yumrepo('nodesource') - is_expected.to contain_yumrepo('nodesource-source') end end @@ -1397,7 +1285,6 @@ it 'the nodesource yum repo files should not exist' do is_expected.to contain_yumrepo('nodesource').with('ensure' => 'absent') - is_expected.to contain_yumrepo('nodesource-source').with('ensure' => 'absent') end end @@ -1408,7 +1295,6 @@ it 'the yumrepo resource should contain proxy = absent' do is_expected.to contain_yumrepo('nodesource').with('proxy' => 'absent') - is_expected.to contain_yumrepo('nodesource-source').with('proxy' => 'absent') end end @@ -1419,7 +1305,6 @@ it 'the yumrepo resource should contain proxy = http://proxy.localdomain.com' do is_expected.to contain_yumrepo('nodesource').with('proxy' => 'http://proxy.localdomain.com') - is_expected.to contain_yumrepo('nodesource-source').with('proxy' => 'http://proxy.localdomain.com') end end @@ -1430,7 +1315,6 @@ it 'the yumrepo resource should contain proxy_password = absent' do is_expected.to contain_yumrepo('nodesource').with('proxy_password' => 'absent') - is_expected.to contain_yumrepo('nodesource-source').with('proxy_password' => 'absent') end end @@ -1441,7 +1325,6 @@ it 'the yumrepo resource should contain proxy_password = password' do is_expected.to contain_yumrepo('nodesource').with('proxy_password' => 'password') - is_expected.to contain_yumrepo('nodesource-source').with('proxy_password' => 'password') end end @@ -1452,7 +1335,6 @@ it 'the yumrepo resource should contain proxy_username = absent' do is_expected.to contain_yumrepo('nodesource').with('proxy_username' => 'absent') - is_expected.to contain_yumrepo('nodesource-source').with('proxy_username' => 'absent') end end @@ -1463,7 +1345,6 @@ it 'the yumrepo resource should contain proxy_username = proxyuser' do is_expected.to contain_yumrepo('nodesource').with('proxy_username' => 'proxyuser') - is_expected.to contain_yumrepo('nodesource-source').with('proxy_username' => 'proxyuser') end end end From 809be696631c17736f2d0d21b0bb555b04c505c0 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Wed, 3 Jan 2024 08:47:45 +0100 Subject: [PATCH 2/3] use new key for 18+ --- .../repo/nodesource/ns-operations-public.key | 52 +++++++++++++++++++ manifests/repo/nodesource/yum.pp | 7 ++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 files/repo/nodesource/ns-operations-public.key diff --git a/files/repo/nodesource/ns-operations-public.key b/files/repo/nodesource/ns-operations-public.key new file mode 100644 index 00000000..0618885e --- /dev/null +++ b/files/repo/nodesource/ns-operations-public.key @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGWFsqMBEAC4YlSuNpHjOiQVTC8StolVx3J8E9SC6G4wmVWbytMD1Zivfanj +3LKDqdy7vpbViXA9whpyGQgQYdOlPKaNHWw4GSeGTnP1FbvaK1NJ9MnAzUysh49R +cqoktYeIQbqgOgZHw5/gVH5bYObf1KJQ2LY/je9WTlW3QMRe1TaW0F0AZnJMBIOG +JllE33QIpxDnOQHnvdUGq+HscUOTrW4Q3AdzwsQxU4GX82d9qFFr8HjAmUjlUKyh +PgvMpb8VDvR7NE6et+wWh6BMYILo3VJFP7/gTXGiy3WWs5GW/PNXIXw5/f2w1B+e +Dh5tlfGG4q/4P8mbv7C6RPHoF2Lq+W69HLqSq/l42WUL41tHlFTsluCIKpeeMxAu +olxx3Z5momHMMyh7rbZtQDqFMTAqxNjT1NinKkWyj7KP5WE9hVosyd3UMR4UYDMm +Zb6LI4N7Hht887+CY7grxTJ9cGQhMFfvLyvlf/FWQY4S6G7sEaUV71N9StvXBNG/ +iNoIMzhwjBmrmvT/UGPkLSi0SIBOxeGw2rwngnYikIJxuTQ4V40lm8o6eMFca7rW +BQvAEncV8pvi/3FqrUBZ/U53s7NO24hBDoaQPzFbVCw0GHHf9GD7KoQb5c9ONoCZ +Qu2YWo7ajPLzl/h2pJ2Kn29Ywev9MpuuPTGvifiKilcBVLYP3ZJg4ZfRBwARAQAB +tDFOb2Rlc291cmN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R1AgUdWSC0rAmvEdFjXgaoQd+Z2eJFHEAsg91URd9NtdeDsyMwdbHh +iBZPGX5ddPjJA7nwKbkibCv7xiodd9ph8NmGLqD/2SDU1rqvPuCDMqLuxc89Gvhs +3CeLTSJK9Uzb3oNdZLxL8CECip1ZkowVfTL+jY23phS9+Z0Db/yZqot3ZZJAAG8g +oSVkzT/Mwp9zFVQu5w== +=drMP +-----END PGP PUBLIC KEY BLOCK----- diff --git a/manifests/repo/nodesource/yum.pp b/manifests/repo/nodesource/yum.pp index fc4b15b5..e5447e87 100644 --- a/manifests/repo/nodesource/yum.pp +++ b/manifests/repo/nodesource/yum.pp @@ -43,12 +43,17 @@ require => File['/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL'], } + $gpg_source = $url_suffix ? { + '16.x' => 'NODESOURCE-GPG-SIGNING-KEY-EL', + default => 'ns-operations-public.key', + } + file { '/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL': ensure => file, group => '0', mode => '0644', owner => 'root', - source => "puppet:///modules/${module_name}/repo/nodesource/NODESOURCE-GPG-SIGNING-KEY-EL", + source => "puppet:///modules/${module_name}/repo/nodesource/${gpg_source}", } } From ea16ac7b3e33fef914f2d6a7dc23faf5946ba183 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Wed, 3 Jan 2024 09:26:54 +0100 Subject: [PATCH 3/3] skip NodeJS16 on EL9 --- spec/acceptance/class_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 8abed10e..da4d0524 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -2,6 +2,12 @@ require 'spec_helper_acceptance' +def nodesource_unsupported(nodejs_version) + return unless fact('os.family') == 'RedHat' + return 'Only NodeJS 16 is supported on EL7' if nodejs_version != '16' && fact('os.release.major') == '7' + return 'NodeJS 16 is not supported on EL9' if nodejs_version == '16' && fact('os.release.major') == '9' +end + describe 'nodejs' do case fact('os.family') when 'RedHat' @@ -29,7 +35,7 @@ end end - context "explicitly using version #{nodejs_version} from nodesource", if: %w[RedHat Debian].include?(fact('os.family')), skip: (nodejs_version != '16' && fact('os.family') == 'RedHat' && fact('os.release.major') == '7' ? 'Only NodeJS 16 is supported on EL7' : nil) do + context "explicitly using version #{nodejs_version} from nodesource", if: %w[RedHat Debian].include?(fact('os.family')), skip: nodesource_unsupported(nodejs_version) do # Only nodejs 16 is supported on EL7 by nodesource include_examples 'cleanup'