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

add dnfmodule repo implementation #488

Closed evgeni closed 8 months ago

ekohl commented 8 months ago

This is a new one for me:

            broken groups or modules: nodejs:18
        Error: /Stage[main]/Nodejs::Repo::Dnfmodule/Package[nodejs dnf module]/ensure: change from 'purged' to '18' failed: Could not update: Execution of '/usr/bin/dnf module install -d 0 -e 1 -y nodejs:18' returned 1: Error: Problems in request:
        broken groups or modules: nodejs:18
evgeni commented 8 months ago

It started once I dropped the enable_only 🤔

ekohl commented 8 months ago

It made me look it up: enable_only makes it dnf module enable instead of dnf module install (https://github.com/puppetlabs/puppet/blob/5dae3b1f808d4fe0def1c5673c65273d2466ff43/lib/puppet/provider/package/dnfmodule.rb#L88-L103). I guess that doesn't work for the nodejs module.

ekohl commented 8 months ago

And there is code that should catch that error, but looks like that doesn't work.

evgeni commented 8 months ago

Modules really, really, should never be installed (it was a mistake to allow that). (end-of-rant)

evgeni commented 8 months ago

And there is code that should catch that error, but looks like that doesn't work.

The match is: /^(?:missing|broken) groups or modules: #{Regexp.quote(@resource[:name])}$/, so in our case: ^broken groups or modules: nodejs$, but the output is "… nodejs:18".

I think the match should be /^(?:missing|broken) groups or modules: #{Regexp.quote(args)}$/ instead

Yeah, using 389-ds from the original ticket, I see:

# dnf module install -d 0 -e 1 -y 389-ds
Error: Problems in request:
broken groups or modules: 389-ds

# dnf module install -d 0 -e 1 -y 389-ds:1.4
Error: Problems in request:
broken groups or modules: 389-ds:1.4

# dnf module install -d 0 -e 1 -y 389-ds:1.4/sdf
Error: Problems in request:
missing groups or modules: 389-ds:1.4/sdf
evgeni commented 8 months ago

also, no idea why exactly 18 has no default profile:

# dnf module list nodejs
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:07:22 ago on Sun Oct 29 17:42:59 2023.
CentOS Stream 8 - AppStream
Name                                            Stream                                         Profiles                                                                      Summary                                                   
nodejs                                          10 [d]                                         common [d], development, minimal, s2i                                         Javascript runtime                                        
nodejs                                          12                                             common [d], development, minimal, s2i                                         Javascript runtime                                        
nodejs                                          14                                             common [d], development, minimal, s2i                                         Javascript runtime                                        
nodejs                                          16                                             common [d], development, minimal, s2i                                         Javascript runtime                                        
nodejs                                          18                                             common, development, minimal, s2i                                             Javascript runtime                                        
nodejs                                          20                                             common [d], development, minimal, s2i                                         Javascript runtime                                        

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
evgeni commented 8 months ago

also, no idea why exactly 18 has no default profile

LOOK MA, TWO BUGS FOR THE PRICE OF ONE!

# dnf module list nodejs
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
Name                                           Stream                                            Profiles                                                                     Summary                                                  
nodejs                                         10 [d][e]                                         common [d], development, minimal, s2i                                        Javascript runtime                                       
nodejs                                         12                                                common [d], development, minimal, s2i                                        Javascript runtime                                       
nodejs                                         14                                                common [d], development, minimal, s2i                                        Javascript runtime                                       
nodejs                                         16                                                common [d], development, minimal, s2i                                        Javascript runtime                                       
nodejs                                         18                                                common [d], development, minimal, s2i                                        Javascript runtime                                       
# dnf module list nodejs
Oracle Linux 8 Application Stream (x86_64)
Name                                            Stream                                         Profiles                                                                      Summary                                                   
nodejs                                          10 [d]                                         common [d], development, minimal, s2i                                         Javascript runtime                                        
nodejs                                          12                                             common [d], development, minimal, s2i                                         Javascript runtime                                        
nodejs                                          14                                             common [d], development, minimal, s2i                                         Javascript runtime                                        
nodejs                                          16                                             common [d], development, minimal, s2i                                         Javascript runtime                                        
nodejs                                          18                                             common [d], development, minimal, s2i                                         Javascript runtime                      
evgeni commented 8 months ago

LOOK MA, TWO BUGS FOR THE PRICE OF ONE!

https://issues.redhat.com/browse/RHEL-14970

evgeni commented 8 months ago

I think the match should be /^(?:missing|broken) groups or modules: #{Regexp.quote(args)}$/ instead

https://github.com/puppetlabs/puppet/pull/9138