Issue #12678 has been updated by Todd Zullinger.

Agreed that this would be convenient.  If extended to other package providers, 
it might also help with differences in package names.

I've spent all of about ten minutes on this, so I'm likely missing a number of 
things.  But, a start on this might be as simple as adding --whatrequires in 
the rpm provider's query method.  E.g.:

    $ diff -u puppet/provider/package/rpm.rb{.orig,}
    --- puppet/provider/package/rpm.rb.orig     2011-06-22 17:00:45.000000000 
-0400
    +++ puppet/provider/package/rpm.rb  2012-02-15 18:46:24.104553370 -0500
    @@ -55,7 +55,7 @@
    #NOTE: Prior to a fix for issue 1243, this method potentially returned a 
cached value
    #IF YOU CALL THIS METHOD, IT WILL CALL RPM
    #Use get(:property) to check if cached values are available
    -    cmd = ["-q", @resource[:name], "--nosignature", "--nodigest", "--qf", 
"#{NEVRAFORMAT}\n"]
    +    cmd = ["-q", "--whatprovides", @resource[:name], "--nosignature", 
"--nodigest", "--qf", "#{NEVRAFORMAT}\n"]
    begin
    output = rpm(*cmd)

This doesn't seem to work for ensure => latest.  I suspect that yumhelper's 
output might need to include all the provides for packages with updates.  I 
didn't try that yet.  Nor did I try ensure => $version-$release.
----------------------------------------
Bug #12678: yum provider doesn't respect items provided by a package, only the 
package name
https://projects.puppetlabs.com/issues/12678#change-54944

Author: Michael Stahnke
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.7.10
Keywords: yum package provides whatprovides
Branch: 


A simple use case:

In EL5 and earlier, the curl development headers were included in a package 
called curl-devel.  In EL6 and later that package was renamed to libcurl-devel. 
 However, the libcurl-devel package still provides curl-devel.  

When using something like 

    package { "curl-devel":
      ensure => installed
    }

puppet looks for this package every time. 

    [root@centos6-32 ~]# puppet resource package libcurl-devel
    warning: Package kernel found in both yum and yum; skipping the yum version
    warning: Package gpg-pubkey found in both yum and yum; skipping the yum 
version
    package { 'libcurl-devel':
      ensure => '7.19.7-26.el6_1.2',
    }
    [root@centos6-32 ~]# puppet resource package curl-devel
    warning: Package kernel found in both yum and yum; skipping the yum version
    warning: Package gpg-pubkey found in both yum and yum; skipping the yum 
version
    package { 'curl-devel':
        ensure => 'absent',
    }
    [root@centos6-32 ~]# rpm -q --whatprovides curl-devel
    libcurl-devel-7.19.7-26.el6_1.2.i686
    [root@centos6-32 ~]# 

The yum provider should basically use the way yum work to make this happen.  If 
I do "yum install curl-devel" on EL6, it pulls in libcurl-devel.  If I then do 
an rpm -q --whatprovides curl-devel it shows that libcurl-devel provides that, 
and thus something does not need to be installed.  

Fixing this would likely have the side-benefit of being able to use the file 
installation methods on yum as well.  Such as
    yum install /usr/bin/foo

Puppet would be like
  package { "/usr/bin/foo": 
     ensure => installed,
  }

That would then install whatever package contains the file /usr/bin/foo, as yum 
from the CLI does.  




-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to