Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider error on ubuntu 24.04 #24

Open
peterwoj opened this issue Jun 15, 2024 · 14 comments · May be fixed by #36
Open

provider error on ubuntu 24.04 #24

peterwoj opened this issue Jun 15, 2024 · 14 comments · May be fixed by #36

Comments

@peterwoj
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 8.4.0
  • Ruby: 3.2.3
  • Distribution: Ubuntu 24.04 LTS (Noble Numbat)
  • Module version: 1.1.1

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

Attempt to install a module on 24.04

package { 'tree': ensure => 'installed', provider => 'snap', install_options => [ 'classic' ] }

What are you seeing

On the target machine puppet fails to run and doesn't recognize snap as being active.

The logs in foreman show

resource: /Stage[main]/Profile::Base::Packages/Package[tree]
message:Provider snap is not functional on this host

What behaviour did you expect instead

That the tree snap would be installed on the target system

Output log

Any additional information you'd like to impart

Not sure if the fix is correct, in order to progress I needed to change the provider from "puppet_gem" to "gem"

`
service { 'snapd':
ensure => $service_ensure,
enable => $service_enable,
require => Package['snapd'],
}

-> package { 'net_http_unix':
  ensure   => $net_http_unix_ensure,
  provider => "gem",
}

`

@root-expert
Copy link
Owner

Hello @peterwoj, this seems to be related to the version of the agent you are using. You should use the AIO packages from Puppet instead of the distro packages.

@peterwoj
Copy link
Author

@root-expert will give it a look and comment back early next week, thanks for the reply

@msu-ts
Copy link

msu-ts commented Oct 21, 2024

Hello, any updates on this issue? We like to use puppet-snap on Ubuntu 24.04 and face the same problem. Kind regards

@root-expert
Copy link
Owner

root-expert commented Oct 30, 2024

@msu-ts hello, could you possibly test if the suggestion above works for you? It seems to be working fine on the acceptance tests with AIO packages from Puppet.

@msu-ts
Copy link

msu-ts commented Oct 30, 2024

@root-expert Hello, on one of the system the suggestion works and there are no errors. But I have a cluster-setup with two nodes running pacemaker, which installs ruby. Here I get an error:
Debug: Puppet::Type::Package::ProviderSnap: feature net_http_unix_lib is missing Error: /Package[aws-cli]: Provider snap is not functional on this host
I can't uninstall ruby here but would like to use your module for installing aws-cli with snap. If more information are needed, feel free to ask.

@nick-oconnor
Copy link

nick-oconnor commented Nov 22, 2024

The lastest arm64 packages for puppet are missing the net_http_unix gem. I fixed this on my clients by adding the following to my puppet code:

package { 'net_http_unix':
   ensure   => 'installed',
   provider => 'puppet_gem',
}

@wornet-mwo
Copy link

The gem instead of puppet_gem solution works in my case. I'm assuming it's because we use puppet apply called on a regular environment rather the puppet-agent which may use a bundled environment and bundled ruby gems.

So the provider value of the package may should be changed to something like (('aio_agent_version' in $facts) ? { true => 'puppet_gem', default => 'gem' }). However i'm not able to test it as i don't have available an environment using the bundled versions of ruby and it's gems.

@wornet-mwo
Copy link

Additional finding: Ubuntu 22 Puppetlabs-packages use the bundled ruby and the condition works fine. However there is PR #36 open which may remove the dependency completely which is also a solution. So i'm not creating a concurrent PR.

@root-expert
Copy link
Owner

Hello @wornet-mwo the solution would be to use AIO puppet-agent package provided by Puppet repos and not by Ubuntu repos. In that case the provider should work as expected.

The linked PR imho is not a good solution. Copying code and maintaining is something I wouldn't like to do.

@root-expert
Copy link
Owner

@nick-oconnor hello, this is something already the provider is doing. Check here. Ensure net_http_unix_ensure is set to installed in your manifests.

@wornet-mwo
Copy link

Hello @wornet-mwo the solution would be to use AIO puppet-agent package provided by Puppet repos and not by Ubuntu repos. In that case the provider should work as expected.

Sure. But that's something you can't assume when writing a module.

The linked PR imho is not a good solution. Copying code and maintaining is something I wouldn't like to do.

Okay. I can provide one with the selector from above (but only hand tested in the available infrastructure).

@root-expert
Copy link
Owner

Sure I can't assume it, but that's the recommended way to install puppet by Puppet Inc.

Using gem provider instead of puppet_gem could possibly cause issues when other ruby versions are installed on the system, since puppet_gem provider manages gems for the puppet-agent's bundled ruby version.

I believe a good solution would be to include a new parameter called manage_net_http_unix_lib with default value of true and wrap the package resource into it. That way if someone want to manage net_http_unix lib in another way they are free to do it by setting the parameter to false.

@wornet-mwo
Copy link

Sure I can't assume it, but that's the recommended way to install puppet by Puppet Inc.

Maybe. We see above, not all puppet installations are done the recommended way (imagine an upgraded Ubuntu, Puppetlabs does not provide own packages yet (really no offence, that's how open source works), but Ubuntu packages puppet-agent matching to the system -> the package of Ubuntu gets installed). That's why i think the selector is a good idea without the Sysadmin using puppet needing to know what's breaking here and the chance messing up the system's gems by installing an additional one is quite low.

Using gem provider instead of puppet_gem could possibly cause issues when other ruby versions are installed on the system, since puppet_gem provider manages gems for the puppet-agent's bundled ruby version.

I believe a good solution would be to include a new parameter called manage_net_http_unix_lib with default value of true and wrap the package resource into it. That way if someone want to manage net_http_unix lib in another way they are free to do it by setting the parameter to false.

I get your point. However this needs to be documented very well as this kind of ticket will be reopened after each OS-Release. Please imagine the POV of the typical sysadmin (i think many puppet users (even advanced) are in the same situation): I'm not aware why that lib is required for Snap - i just need to get it running and puppet does not print a helpful error message hinting you to any parameter. So any solution that works inside the module helps.

@southalc
Copy link

I can agree that #36 is not an ideal solution, but I think it's better than requiring external gems. I expect modules to be portable and able to drop-in to any puppet environment with only a puppet version and other modules as dependencies. In this case the ~40 lines of code copied from the required gem is worth the portability, and unlikely to require much if any maintenance.

Another solution might be to include the HTTPUnix class in some other common module like stdlib or maybe extlib. Then that simple dependency can be identified in module metadata and be deployed anywhere with reasonable expectation that it will just work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants