voxpupuli / puppet-nodejs

Puppet module to install nodejs and global npm packages
https://forge.puppet.com/puppet/nodejs
Apache License 2.0
113 stars 248 forks source link

Nodejs package fails to install, seems to set incorrect baseurl in nodesource.repo #463

Open b-penn opened 1 year ago

b-penn commented 1 year ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

Puppet configuration pulled directly from puppet-nodejs documentation but uses 16.x repu_url_suffix:

class { 'nodejs': 
  repo_url_suffix => '16.x'
}

What are you seeing

After applying the manifest, nodejs fails to install.

Debug: Package[nodejs](provider=yum): Ensuring => present
Debug: Executing: '/bin/yum -d 0 -e 0 -y install nodejs'
Error: Execution of '/bin/yum -d 0 -e 0 -y install nodejs' returned 1: Error downloading packages:
  2:nodejs-16.19.1-1nodesource.x86_64: [Errno 256] No more mirrors to try.
Error: /Stage[main]/Nodejs::Install/Package[nodejs]/ensure: change from 'purged' to 'present' failed: Execution of '/bin/yum -d 0 -e 0 -y install nodejs' returned 1: Error downloading packages:
  2:nodejs-16.19.1-1nodesource.x86_64: [Errno 256] No more mirrors to try.

In addition, baseurl seems to be overwritten with the incorrect version for some reason, switching from the expected /pub_16.x to /pub_12.x.

Notice: /Stage[main]/Nodejs::Repo::Nodesource::Yum/Yumrepo[nodesource]/baseurl: baseurl changed 'https://rpm.nodesource.com/pub_16.x/el/7/$basearch' to 'https://rpm.nodesource.com/pub_12.x/el/7/$basearch'
Debug: /Stage[main]/Nodejs::Repo::Nodesource::Yum/Yumrepo[nodesource]: The container Class[Nodejs::Repo::Nodesource::Yum] will propagate my refresh event
Notice: /Stage[main]/Nodejs::Repo::Nodesource::Yum/Yumrepo[nodesource-source]/baseurl: baseurl changed 'https://rpm.nodesource.com/pub_16.x/el/7/SRPMS' to 'https://rpm.nodesource.com/pub_12.x/el/7/SRPMS'
Debug: /Stage[main]/Nodejs::Repo::Nodesource::Yum/Yumrepo[nodesource-source]: The container Class[Nodejs::Repo::Nodesource::Yum] will propagate my refresh event
Debug: Class[Nodejs::Repo::Nodesource::Yum]: The container Stage[main] will propagate my refresh event
Debug: Class[Nodejs::Repo::Nodesource::Yum]: The container Class[Nodejs::Repo::Nodesource] will propagate my refresh event
Debug: Class[Nodejs::Repo::Nodesource]: The container Stage[main] will propagate my refresh event

baseurl is of course written out by puppet-nodejs in /etc/yum.repos.d/nodesource.repo.

[nodesource]
name=Node.js Packages for Enterprise Linux 7 - $basearch
baseurl=https://rpm.nodesource.com/pub_12.x/el/7/$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
failovermethod=priority

What behaviour did you expect instead

Based on documentation, I expect puppet-nodejs to install the major version of nodejs defined in the repu_url_suffix parameter. In this case, 16.x

Output log

Any additional information you'd like to impart

After the manifest has run and failed, but nodesource.repo has been place, I can try and run the package install command manually.

sudo /bin/yum install nodejs
---> Package nodejs.x86_64 2:16.19.1-1nodesource will be installed
...
nodejs-16.19.1-1nodesource.x86 FAILED
https://rpm.nodesource.com/pub_12.x/el/7/x86_64/nodejs-16.19.1-1nodesource.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found

The package url is indeed trying to reference the incorrect pub_12.x version specific in nodesource.repo