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 b17954e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 57 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
4 changes: 1 addition & 3 deletions manifests/repo/nodesource/apt.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# 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
Expand All @@ -19,7 +17,7 @@
},
location => "https://deb.nodesource.com/node_${url_suffix}",
pin => $pin,
release => $release,
release => 'nosource',
repos => 'main',
}

Expand Down
22 changes: 0 additions & 22 deletions manifests/repo/nodesource/yum.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +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 ? {

Check warning on line 11 in manifests/repo/nodesource/yum.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

top-scope variable being used without an explicit namespace (check: variable_scope)
true => '1',
Expand Down Expand Up @@ -52,21 +49,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 +63,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 b17954e

Please sign in to comment.