[PUP-897] package type should accept virtual package for rpm Created: 2013/11/26  Updated: 2016/10/19  Resolved: 2014/02/25

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: PUP 3.5.0

Type: New Feature Priority: Normal
Reporter: redmine.exporter Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: redmine
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
is blocked by PUP-923 Add Fedora 20 to acceptance Closed
Relates
relates to PUP-2039 rpm provider broken for architecture ... Closed
relates to PUP-2182 Package resource not working as expec... Closed
Template:
Epic Link: RHEL 7 Support
Story Points: 3
Sprint: Week 2014-2-5 to 2014-2-12, Week 2014-2-12 to 2014-2-19, Week 2014-2-19 to 2014-2-26

 Description   

Rpm ( like many similar package systems ) define a system of virtual package, with the tag Provides.
For example, on Mandriva, we have :

    $ rpm -q --provides perl-Term-Size-Any-0.1.0-2mdv2010.1
    perl(Term::Size::Any) = 0.1.0
    perl-Term-Size-Any = 0.1.0-2mdv2010.1

So I can use "urpmi perl(Term::Size::Any)" to install the rpm.
On puppet, the type package do not seem to take this fully in account.
if I use this :

    package { 'perl(Term::Size::Any)': ensure => installed }

The package is installed, but I see a error message :

    err: /Stage[main]//Node[valstar]/Package[perl(Term::Size::Any)]/ensure: change from absent to present failed: Could not find package perl(Term::Size::Any)

Here is a patch that fix this. It should allows to use any Provides for all rpm based package managers, but I only checked with urpmi and yum.
It should work ok on all of them, since using a Provides instead of the exact rpm name is a very common feature.



 Comments   
Comment by Matthew Mosesohn [ 2014/01/27 ]

There is already a patch for this: http://projects.puppetlabs.com/attachments/download/1240/0001-allows-rpm-based-package-managers-to-cleanly-support.patch

What is the main obstacle to merging this?

Comment by Michelle Johansen [ 2014/01/31 ]

Kylo Ginsberg or Ryan McKern Can we get some review here please?

Comment by Ryan McKern [ 2014/01/31 ]

There's a comment in the original conversation on projects.puppetlabs.com from Eric Sorenson:

UPDATED BY ERIC SORENSON 2 MONTHS AGO (11/27/2013)
Target version set to 3.5.0
Pulling this in for 3.5.0 — since there’s code we can probably just do this as part of community pull request triage.

I can confirm that this patch hasn't been merged yet, but that was the last conversation about it.

Comment by Michelle Johansen [ 2014/02/03 ]

Kylo Ginsberg Is this patch ready for merge?

Comment by Kylo Ginsberg [ 2014/02/03 ]

Matthew Mosesohn the only obstacle is that we haven't gotten around to studying the issue just yet, although we got as far as targeting it for 3.5.

Michelle Johansen this ticket hasn't made it into a sprint yet, so I'm not aware of anyone taking a long look at the issue or the patch. Since there's heightened interest, I'm all for pulling this into the next sprint. In fact, I'll do so right now

Comment by Peter Huene [ 2014/02/20 ]

For functional review on RHEL/CentOS/Fedora, you can use a the "vim" virtual package to see if it will install without errors.

package { 'vim':
    ensure => installed
}

Without the fix, yum will install "vim" (vim-enhanced is the package that should be installed) and then rpm will fail to query it, causing an error.

With the fix, yum will install "vim" and then rpm will find the vim virtual package, so it should install successfully.

Comment by Adrien Thebo [ 2014/02/25 ]

I couldn't reproduce with the vim package but I found the 'owncloud-database' package which is a virtual package on Fedora 18. Verified with the following:

[root@fedora puppet]# git checkout 3.4.2 && ruby install.rb 2>/dev/null 1>/dev/null
[root@fedora puppet]# puppet resource package owncloud-database ensure=present
Error: Could not find package owncloud-database
Error: /Package[owncloud-database]/ensure: change from absent to present failed: Could not find package owncloud-database
package { 'owncloud-database':
  ensure => 'absent',
}
[root@fedora puppet]# git checkout master && ruby install.rb 2>/dev/null 1>/dev/null
Previous HEAD position was 5d996ba... (packaging) Update PUPPETVERSION to 3.4.2
Switched to branch 'master'
[root@fedora puppet]# puppet resource package owncloud-database ensure=present
package { 'owncloud-database':
  ensure => '4.5.13-3.fc18',
}

Generated at Sun Dec 15 09:50:29 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.