From ecff085027d0769811bc35eb41f00d806cee2ff5 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 27 Oct 2023 11:00:45 +0200 Subject: [PATCH] default to 16.x on el7 --- manifests/params.pp | 5 ++++- spec/classes/nodejs_spec.rb | 23 +++++++---------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 8a70a8c8..ff11fa3f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -11,7 +11,10 @@ $repo_proxy_password = 'absent' $repo_proxy_username = 'absent' $repo_release = undef - $repo_url_suffix = '18.x' + $repo_url_suffix = ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7') ? { + true => '16.x', + default => '18.x', + } $use_flags = ['npm', 'snapshot'] $cmd_exe_path = $facts['os']['family'] ? { diff --git a/spec/classes/nodejs_spec.rb b/spec/classes/nodejs_spec.rb index 480dd828..b77263d4 100644 --- a/spec/classes/nodejs_spec.rb +++ b/spec/classes/nodejs_spec.rb @@ -292,25 +292,16 @@ end end - ['7.0', '27'].each do |operatingsystemrelease| + ['7.0'].each do |operatingsystemrelease| osversions = operatingsystemrelease.split('.') operatingsystemmajrelease = osversions[0] - if operatingsystemmajrelease == '7' - operatingsystem = 'CentOS' - dist_type = 'el' - repo_baseurl = "https://rpm.nodesource.com/pub_18.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch" - repo_source_baseurl = "https://rpm.nodesource.com/pub_18.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" - else - operatingsystem = 'Fedora' - dist_type = 'fc' - repo_baseurl = "https://rpm.nodesource.com/pub_18.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch" - repo_source_baseurl = "https://rpm.nodesource.com/pub_18.x/#{dist_type}/#{operatingsystemmajrelease}/SRPMS" - repo_descr = "Node.js Packages for Fedora Core #{operatingsystemmajrelease} - $basearch" - repo_source_descr = "Node.js for Fedora Core #{operatingsystemmajrelease} - $basearch - Source" - end + 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" context "when run on #{operatingsystem} release #{operatingsystemrelease}" do let :facts do