voxpupuli/puppet-nodejs

Using third party repo on Debian (11) does not work correctly

sid3windr opened this issue · 2 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.25 (Puppetlabs)
  • Distribution: Debian 11
  • Module version: 9.0.1

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

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

What are you seeing

Starting from a machine which has no node or npm installed at all.

On the first Puppet run when adding the nodejs class to the machine, the nodesource apt repo configuration is added. Node is installed from Debian sources (not the 3rd party repo) along with a zillion node-* support packages. The npm package is pulled in by this, I believe, then removed by the Puppet module at the end of the run.

I run apt-get upgrade to install available updates. This, now using the nodesource apt repo, will remove all packages pulled in earlier and replace them by a single nodejs package in version 16, as requested.

On every Puppet run after this upgrade happened, the module now tries to install the npm package from Debian's repositories, which conflicts with the nodesource nodejs package (which already contains its own npm, it is not a separate package). The Puppet run fails due to this error.

Setting npm_package_ensure to absent makes no difference to this behaviour.

What behaviour did you expect instead

Installation of node v16 (preferrably immediately), but more importantly, non-failing Puppet runs after this has happened.

Output log

Info: Applying configuration version '1687605455'
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install npm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libnode72 : Conflicts: nodejs-legacy
 nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.

Duplicate of #452
See #452 (comment) for a workaround

The outcome is markedly differnet though, in the case of #452 npm and because of that nodejs is removed again but their Puppet run is not broken. This is not the case in my output above - the module in fact tries to install npm when it shouldn't, failing the run.

Setting npm_package_name to false (both through class parameter and hiera) does not fix this situation either - it tries to do exactly the same, and the run still fails.

Info: Applying configuration version '1688501423'
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install npm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libnode72 : Conflicts: nodejs-legacy
 nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.
Error: /Stage[main]/Main/Package[yarn]/ensure: change from 'purged' to 'present' failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install npm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libnode72 : Conflicts: nodejs-legacy
 nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages. (corrective)
Info: Class[Main]: Unscheduling all events on Class[Main]
Info: Stage[main]: Unscheduling all events on Stage[main]
Notice: Applied catalog in 20.88 seconds