Skip to content

Commit

Permalink
Merge pull request #481 from voxpupuli/default18
Browse files Browse the repository at this point in the history
Update default release to 18.x, EL7 to 16.x
  • Loading branch information
evgeni authored Oct 27, 2023
2 parents 6c9d83c + 1952085 commit c258246
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 50 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ To install Node.js and npm (using the NodeSource repository if possible):
class { 'nodejs': }
```

The default version installed is currently `12.x`.
The default version installed is currently `18.x`.

If you wish to install a Node.js 13.x release from the NodeSource repository
rather than 12.x on Debian/RHEL platforms:
If you wish to install a Node.js 21.x release from the NodeSource repository
rather than 18.x on Debian/RHEL platforms:

```puppet
class { 'nodejs':
repo_url_suffix => '13.x',
repo_url_suffix => '21.x',
}
```

Expand Down
7 changes: 5 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
$repo_proxy_password = 'absent'
$repo_proxy_username = 'absent'
$repo_release = undef
$repo_url_suffix = '12.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'] ? {
Expand All @@ -38,7 +41,7 @@
$nodejs_dev_package_name = 'nodejs-devel'
$nodejs_dev_package_ensure = 'absent'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_ensure = 'present'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = 'nodejs::repo::nodesource'
Expand Down
50 changes: 28 additions & 22 deletions manifests/repo/nodesource/yum.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,40 @@
owner => 'root',
source => "puppet:///modules/${module_name}/repo/dnf/nodejs.module",
}

$module_hotfixes = true
} else {
$module_hotfixes = undef
}

yumrepo { 'nodesource':
descr => $descr,
baseurl => $baseurl,
enabled => '1',
failovermethod => $yum_failovermethod,
gpgkey => 'file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL',
gpgcheck => '1',
priority => $priority,
proxy => $proxy,
proxy_password => $proxy_password,
proxy_username => $proxy_username,
require => File['/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL'],
descr => $descr,
baseurl => $baseurl,
enabled => '1',
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'],
}

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',
priority => $priority,
proxy => $proxy,
proxy_password => $proxy_password,
proxy_username => $proxy_username,
require => File['/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL'],
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':
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class { 'nodejs':
let(:manifest) do
<<-PUPPET
class { 'nodejs': }
nodejs::npm::global_config_entry { '//path.to.registry/:_secret':
nodejs::npm::global_config_entry { '//path.to.registry/:_authToken':
ensure => present,
value => 'cGFzc3dvcmQ=',
require => Package[nodejs],
Expand All @@ -109,7 +109,7 @@ class { 'nodejs': }
describe 'npm config' do
it 'contains the global_config_entry secret' do
npm_output = shell('cat $(/usr/bin/npm config get globalconfig)')
expect(npm_output.stdout).to match '//path.to.registry/:_secret="cGFzc3dvcmQ="'
expect(npm_output.stdout).to match '//path.to.registry/:_authToken="cGFzc3dvcmQ="'
end
end
end
Expand All @@ -121,7 +121,7 @@ class { 'nodejs': }
let(:manifest) do
<<-PUPPET
class { 'nodejs': }
nodejs::npm::global_config_entry { '//path.to.registry/:_secret':
nodejs::npm::global_config_entry { '//path.to.registry/:_authToken':
ensure => present,
value => 'cGFzc3dvcmQ',
require => Package[nodejs],
Expand All @@ -133,7 +133,7 @@ class { 'nodejs': }
describe 'npm config' do
it 'contains the global_config_entry secret' do
npm_output = shell('cat $(/usr/bin/npm config get globalconfig)')
expect(npm_output.stdout).to match '//path.to.registry/:_secret=cGFzc3dvcmQ'
expect(npm_output.stdout).to match '//path.to.registry/:_authToken=cGFzc3dvcmQ'
end
end
end
Expand Down
27 changes: 9 additions & 18 deletions spec/classes/nodejs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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_12.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch"
repo_source_baseurl = "https://rpm.nodesource.com/pub_12.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_12.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch"
repo_source_baseurl = "https://rpm.nodesource.com/pub_12.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
Expand Down Expand Up @@ -1312,8 +1303,8 @@
}
end

repo_baseurl = 'https://rpm.nodesource.com/pub_12.x/el/7/$basearch'
repo_source_baseurl = 'https://rpm.nodesource.com/pub_12.x/el/7/SRPMS'
repo_baseurl = 'https://rpm.nodesource.com/pub_18.x/el/7/$basearch'
repo_source_baseurl = 'https://rpm.nodesource.com/pub_18.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'

Expand Down

0 comments on commit c258246

Please sign in to comment.