Jira (PUP-9397) yum package provider fails when run as non root during noop

1 view
Skip to first unread message

Craig Genner (JIRA)

unread,
Jan 4, 2019, 3:32:03 PM1/4/19
to puppe...@googlegroups.com
Craig Genner created an issue
 
Puppet / Bug PUP-9397
yum package provider fails when run as non root during noop
Issue Type: Bug Bug
Affects Versions: PUP 5.5.8, PUP 4.10.0
Assignee: Unassigned
Components: Types and Providers
Created: 2019/01/04 12:31 PM
Priority: Normal Normal
Reporter: Craig Genner

Puppet Version: 5.5.8
Puppet Server Version: NA
OS Name/Version: CentOS 6 & 7

When running a puppet apply in `noop` mode as a non root user, the catalog fails to apply and errors "The yum provider can only be used as root".

This is due to `lib/puppet/provider/package/yum.rb` line 29 where the package prefix errors if the apply is not done as root.

 

Desired Behavior:

$ puppet apply --noop -e 'package { "moreutils": ensure => installed}'

Notice: Compiled catalog for centos7.localdomain in environment production in 1.35 seconds
Notice: /Stage[main]/Main/Package[moreutils]/ensure: current_value purged, should be present (noop)
Notice: Class[Main]: Would have triggered 'refresh' from 1 events
Notice: Stage[main]: Would have triggered 'refresh' from 1 events
Notice: Applied catalog in 0.27 seconds

Actual Behavior:

$ puppet apply --noop -e 'package { "moreutils": ensure => installed}'

Notice: Compiled catalog for centos7.localdomain in environment production in 1.27 seconds
Error: Failed to apply catalog: The yum provider can only be used as root

 

It appears that the raising of the error does not take into account running in `noop` mode, I've tried to find out how to fix this but I;m not familiar enough with the puppet code.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Rob Braden (JIRA)

unread,
Jan 7, 2019, 4:55:03 PM1/7/19
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 14, 2021, 8:52:02 PM6/14/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-9397
 
Re: yum package provider fails when run as non root during noop

The check for root was added in https://github.com/puppetlabs/puppet/commit/8722e439b71de005a56820b3e3cf704e3a5b5c8c, back when the provider ran a python script to interact with yum. You could probably just remove that check in https://github.com/puppetlabs/puppet/blob/ba7ba7285ccfbb659c9ea6c52245508a8795df89/lib/puppet/provider/package/yum.rb#L68-L71. Amd in fact, you could remove the entire overridden method and just rely on the superclass behavior. That said, we don't have plans on fixing this and I'm going to close. If you'd like to contribute a pull request, please reopen and let us know in slack.

This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages