Skip to content

Commit

Permalink
switch to using the nodistro nodesource repos
Browse files Browse the repository at this point in the history
the other ones do not contain the latest releases
(e.g. 20.x contains 20.5 vs 20.9)
  • Loading branch information
evgeni committed Oct 28, 2023
1 parent ff1fd3f commit 2a85938
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 65 deletions.
34 changes: 2 additions & 32 deletions manifests/repo/nodesource.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,9 @@

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"
$descr = "Node.js Packages - \$basearch"
$baseurl = "https://rpm.nodesource.com/pub_${url_suffix}/nodistro/nodejs/\$basearch"

contain 'nodejs::repo::nodesource::yum'
}
Expand Down
7 changes: 1 addition & 6 deletions manifests/repo/nodesource/apt.pp
Original file line number Diff line number Diff line change
@@ -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',
},
location => "https://deb.nodesource.com/node_${url_suffix}",
pin => $pin,
release => $release,
release => 'nosource',
repos => 'main',
}

Expand Down
27 changes: 0 additions & 27 deletions manifests/repo/nodesource/yum.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@
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',
}

$yum_failovermethod = (versioncmp($facts['os']['release']['major'], '8') >= 0 and $priority == 'absent') ? {
true => 'absent',
Expand Down Expand Up @@ -52,21 +44,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',
Expand All @@ -81,10 +58,6 @@
ensure => 'absent',
}

yumrepo { 'nodesource-source':
ensure => 'absent',
}

if versioncmp($facts['os']['release']['major'], '8') >= 0 {
file { 'dnf_module':
ensure => absent,
Expand Down

0 comments on commit 2a85938

Please sign in to comment.