Jira (PUP-11623) RPM package types unable to handle multiple providers for a virtual package

32 views
Skip to first unread message

Mihkel Ader (Jira)

unread,
Sep 5, 2022, 10:48:01 AM9/5/22
to puppe...@googlegroups.com
Mihkel Ader created an issue
 
Puppet / Bug PUP-11623
RPM package types unable to handle multiple providers for a virtual package
Issue Type: Bug Bug
Affects Versions: PUP 7.18.0
Assignee: Unassigned
Components: Types and Providers
Created: 2022/09/05 7:47 AM
Priority: Normal Normal
Reporter: Mihkel Ader

Puppet Version: 7.18.0
Puppet Server Version: N/A
OS Name/Version: CentOS 7, Alma Linux 8, Oracle Linux 8

When checking whether a package is already present, Puppet queries RPM using the package name and also using '–whatprovides' in case the requested object is a virtual package provided by some other.

When the virtual package is provided by multiple installed RPMs, Puppet fails with the following message: "Could not evaluate: no implicit conversion of Array into Hash"

Easily reproduced by trying to apply this simple manifest on a system from RedHat family with both curl and wget installed:

package

{ 'webclient':   ensure => installed, }

(We use 'webclient' here to provide an easily reproducible case. Our real issue is with 'perf' package on Oracle Linux that is provided by kernel-uek and a system can have several kernels installed.)

Desired Behavior:

Puppet understands that the requested object is already present from multiple sources and does nothing.

Actual Behavior:

Puppet fails with error:

  1. puppet apply -e "package { 'webclient': }"
    Notice: Compiled catalog for XX in environment production in 0.02 seconds
    Error: /Stage[main]/Main/Package[webclient]: Could not evaluate: no implicit conversion of Array into Hash

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Mihkel Ader (Jira)

unread,
Sep 5, 2022, 10:51:01 AM9/5/22
to puppe...@googlegroups.com
Mihkel Ader updated an issue
Change By: Mihkel Ader
*Puppet Version: 7.18.0*
*Puppet Server Version: N/A*
*OS Name/Version: CentOS 7, Alma Linux 8, Oracle Linux 8*


When checking whether a package is already present, Puppet queries RPM using the package name and also using '–whatprovides' in case the requested object is a virtual package provided by some other.

When the virtual package is provided by multiple installed RPMs, Puppet fails with the following message: "Could not evaluate: no implicit conversion of Array into Hash"

Easily reproduced by trying to apply this simple manifest on a system from RedHat family with both curl and wget installed:

 
{code:java}
package { 'webclient':
  ensure => installed,
}
{code}
 

(We use 'webclient' here to provide an easily reproducible case. Our real issue is with 'perf' package on Oracle Linux that is provided by kernel-uek and a system can have several kernels installed.)

*Desired Behavior:*


Puppet understands that the requested object is already present from multiple sources and does nothing.

*Actual Behavior:*

Puppet fails with error:

 
{code:java}
# puppet apply -e "package \ { 'webclient': }"

Notice: Compiled catalog for XX in environment production in 0.02 seconds
Error: /Stage[main]/Main/Package[webclient]: Could not evaluate: no implicit conversion of Array into Hash
 
{code}
 

Mihkel Ader (Jira)

unread,
Sep 5, 2022, 10:56:02 AM9/5/22
to puppe...@googlegroups.com
Error: /Stage[main]/Main/Package[webclient]: Could not evaluate: no implicit conversion of Array into Hash # rpm -q --whatprovides webclient
  wget-1.14-18.el7_6.1.x86_64
curl-7.29.0-59.el7_9.1.x86_64
 
{code}
 


 

Mihkel Ader (Jira)

unread,
Sep 5, 2022, 10:56:04 AM9/5/22
to puppe...@googlegroups.com
Mihkel Ader updated an issue
*Puppet Version: 7.18.0*
*Puppet Server Version: N/A*
*OS Name/Version: CentOS 7, Alma Linux 8, Oracle Linux 8*

When checking whether a package is already present, Puppet queries RPM using the package name and also using '–whatprovides' in case the requested object is a virtual package provided by some other.

When the virtual package is provided by multiple installed RPMs, Puppet fails with the following message: "Could not evaluate: no implicit conversion of Array into Hash"

Easily reproduced by trying to apply this simple manifest on a system from RedHat family with both curl and wget installed:

 
{code:java}package { 'webclient':
  ensure => installed,
}
{code}
 

(We use 'webclient' here to provide an easily reproducible case. Our real issue is with 'perf' package on Oracle Linux that is provided by kernel-uek and a system can have several kernels installed.)

*Desired Behavior:*

Puppet understands that the requested object is already present from multiple sources and does nothing.

*Actual Behavior:*

Puppet fails with error:

 
{code:java}# puppet apply -e "package { 'webclient': }"
Notice: Compiled catalog for XX in environment production in 0.02 seconds
Error: /Stage[main]/Main/Package[webclient]: Could not evaluate: no implicit conversion of Array into Hash {code}
{code:java}
# rpm -q --whatprovides webclient
wget-1.14-18.el7_6.1.x86_64
curl-7.29.0-59.el7_9.1.x86_64
  {code}
 

 

Morgan Rhodes (Jira)

unread,
Sep 6, 2022, 4:22:03 PM9/6/22
to puppe...@googlegroups.com
Morgan Rhodes commented on Bug PUP-11623
 
Re: RPM package types unable to handle multiple providers for a virtual package

Mihkel Ader thank you for the report! Could we get the output from running that `puppet apply` with `-trace` and `-debug` to help us better diagnose it?

Mihkel Ader (Jira)

unread,
Sep 8, 2022, 9:40:01 AM9/8/22
to puppe...@googlegroups.com

Mihkel Ader (Jira)

unread,
Sep 8, 2022, 9:41:01 AM9/8/22
to puppe...@googlegroups.com

Mihkel Ader (Jira)

unread,
Sep 8, 2022, 9:42:02 AM9/8/22
to puppe...@googlegroups.com

Mihkel Ader (Jira)

unread,
Sep 8, 2022, 9:42:02 AM9/8/22
to puppe...@googlegroups.com

Morgan Rhodes (Jira)

unread,
Sep 13, 2022, 4:12:02 PM9/13/22
to puppe...@googlegroups.com

Morgan Rhodes (Jira)

unread,
Sep 20, 2022, 4:42:03 PM9/20/22
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Sep 27, 2022, 6:30:02 PM9/27/22
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-11623
 
Re: RPM package types unable to handle multiple providers for a virtual package

Thanks for the info Mihkel Ader It looks like this regression was introduced in PUP-9605, specifically https://github.com/puppetlabs/puppet/commit/5af5f9dab8318969ff14c85fe219711035777794#diff-b4d0de06a52daa31f3fbd02acaf3be6becaaff2af1c5c2391b1798e7c11b7579L121-R120

Prior to that change, puppet used to always report on the first package that matched "whatprovides" https://github.com/puppetlabs/puppet/blob/5.5.16/lib/puppet/provider/package/rpm.rb#L121-L123 Note the FIXME comment.

After the change, nevra_to_multiversion_hash either returns a hash or an array of hashes: https://github.com/puppetlabs/puppet/blob/5af5f9dab8318969ff14c85fe219711035777794/lib/puppet/provider/package/rpm.rb#L449-L452.

If whatprovides returns multiple entries, then this line will fail:
https://github.com/puppetlabs/puppet/blob/5af5f9dab8318969ff14c85fe219711035777794/lib/puppet/provider/package/rpm.rb#L120

For this ticket, I think we need to examine all of the call sites to "nevra_to_multiversion_hash" and ensure the caller can handle either the single hash or array of hashes:

https://github.com/puppetlabs/puppet/blob/5af5f9dab8318969ff14c85fe219711035777794/lib/puppet/provider/package/rpm.rb#L87
https://github.com/puppetlabs/puppet/blob/5af5f9dab8318969ff14c85fe219711035777794/lib/puppet/provider/package/rpm.rb#L120
https://github.com/puppetlabs/puppet/blob/5af5f9dab8318969ff14c85fe219711035777794/lib/puppet/provider/package/rpm.rb#L132

Reply all
Reply to author
Forward
0 new messages