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 30, 2023
1 parent e7acbf3 commit 9b93e67
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 233 deletions.
51 changes: 26 additions & 25 deletions files/repo/nodesource/NODESOURCE-GPG-SIGNING-KEY-EL
Original file line number Diff line number Diff line change
@@ -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/DA4YEtfxg8GC3zXC2thMJnFburmts71iiYsxKBc
6d7O8415xrErhk2/o2+bRhf+7qBQfW0oxQSEMBYbqP3hvhG1VWc9umjbCfMgHrHo
IzI7W+GbRdbSsdpY6JNKuCftVfIKXeXk5FbUUP9NzsG/nyGFORkq9y0AKmocx3TD
w9DRG2SmKIKBOG5PQuzuXqsdUaYcFpySXdPNQG2CPtguPhQivw4qM3pQpQARAQAB
tCNOb2RlU291cmNlIDxncGctcnBtQG5vZGVzb3VyY2UuY29tPokCOAQTAQI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
y/5M8x3CTyuMgx5GLDaEUvBusnTD+/v/fBMwRK/cZ9du5PSG4R50rtst+oYyC2ao
x4I2SgjtF/cY7bECsZDplzatN3gv34PkcdIg8SLHAVlL4N5tzumDeizRspcSyoy2
K2+hwKU4C4+dekLLTg8rjnRROvplV2KtaEk6rxKtIRFDCoQng8wfJuIMrDNKvqZw
FRGt7cbvW5MCnuH8MhItOl9Uxp1wHp6gtav/h8Gp6MBa
=MARt
-----END PGP PUBLIC KEY BLOCK-----
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
36 changes: 0 additions & 36 deletions manifests/repo/nodesource.pp
Original file line number Diff line number Diff line change
@@ -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': {
Expand Down
11 changes: 3 additions & 8 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',
'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',
}

Expand Down
34 changes: 3 additions & 31 deletions manifests/repo/nodesource/yum.pp
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -81,10 +57,6 @@
ensure => 'absent',
}

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

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

0 comments on commit 9b93e67

Please sign in to comment.