Jira (PUP-9605) Type package (provider yum) fails when handling kernel packages

0 views
Skip to first unread message

Nicolai Marck Ødum (JIRA)

unread,
Apr 8, 2019, 4:39:02 AM4/8/19
to puppe...@googlegroups.com
Nicolai Marck Ødum created an issue
 
Puppet / Bug PUP-9605
Type package (provider yum) fails when handling kernel packages
Issue Type: Bug Bug
Affects Versions: PUP 4.10.4
Assignee: Unassigned
Components: Types and Providers
Created: 2019/04/08 1:38 AM
Priority: Normal Normal
Reporter: Nicolai Marck Ødum

Puppet Version:

4.10.4

Puppet Server Version:

3.6.2
OS Name/Version:

CentOS 7

Desired Behavior:

*Being able to handle yum packages that in the rare cases in which you can have *multiple versions of a package installed without conflict (e.g., the kernel package)

Actual Behavior:

Error: Could not update: Failed to update to version 3.10.0-957.10.1.el7.x86_64, got version 3.10.0-957.5.1.el7 instead
Error: /Stage[main]/Dap_pcappiper::Install/Package[kernel-devel]/ensure: change from 3.10.0-957.5.1.el7 to 3.10.0-957.10.1.el7.x86_64 failed: Could not update: Failed to update to version 3.10.0-957.10.1.el7.x86_64, got version 3.10.0-957.5.1.el7 instead

package

{'kernel-devel': ensure => '3.10.0-957.10.1.el7.x86_64', }

 

When running i debug mode I can see the following command

/bin/rpm -q kernel-devel --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'

And if I run that I get

sudo /bin/rpm -q kernel-devel --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'
kernel-devel 0 3.10.0 957.5.1.el7 x86_64
kernel-devel 0 3.10.0 957.10.1.el7 x86_64

 

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

Jorie Tappa (JIRA)

unread,
Apr 8, 2019, 12:46:02 PM4/8/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Apr 9, 2019, 11:24:03 AM4/9/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Apr 9, 2019, 11:25:04 AM4/9/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Jun 12, 2019, 4:43:03 AM6/12/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - Triage 2019-06-25

Mihai Buzgau (JIRA)

unread,
Jun 12, 2019, 4:43:03 AM6/12/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Jun 26, 2019, 9:04:08 AM6/26/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - 2019-06-25 , PR - 2019-07-10

Ciprian Badescu (JIRA)

unread,
Jun 26, 2019, 9:30:03 AM6/26/19
to puppe...@googlegroups.com
Ciprian Badescu commented on Bug PUP-9605
 
Re: Type package (provider yum) fails when handling kernel packages

Currently there is support for single version of a package in puppet. There are few places where it is coded like this, all in lib/puppet/provider/package/rpm.rb:

    1. prefetch from lib/puppet/provider/package.rb will use last entry of the package name from instances (rpm -qa)

 

#lib/puppet/provider/package.rb 
def self.prefetch(packages)
    instances.each do |prov|
      if pkg = packages[prov.name]
        pkg.provider = prov
      end
    end
end

 

 

 

#lib/puppet/provider/package.rb   
  def self.instances
    packages = []    # list out all of the packages
    begin
      execpipe("#{command(:rpm)} -qa #{nosignature} #{nodigest} --qf '#{self::NEVRA_FORMAT}'") { |process|
        # now turn each returned line into a package object
        process.each_line { |line|
          hash = nevra_to_hash(line)
          packages << new(hash) unless hash.empty?
        }
      }
    rescue Puppet::ExecutionFailure
      raise Puppet::Error, _("Failed to list packages"), $!.backtrace
    end    
    packages
  end

    2. query from lib/puppet/provider/rpm.rb will use first entry of the package name from `rpm -q #{package_name}`

 

#lib/puppet/provider/rpm.rb
  def query
    #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], "#{self.class.nosignature}", "#{self.class.nodigest}", "--qf", "'#{self.class::NEVRA_FORMAT}'"]    begin
      output = rpm(*cmd)
    rescue Puppet::ExecutionFailure
      return nil unless @resource.allow_virtual?      # rpm -q exits 1 if package not found
      # retry the query for virtual packages
      cmd << '--whatprovides'
      begin
        output = rpm(*cmd)
      rescue Puppet::ExecutionFailure
        # couldn't find a virtual package either
        return nil
      end
    end
    # FIXME: We could actually be getting back multiple packages
    # for multilib and this will only return the first such package
    @property_hash.update(self.class.nevra_to_hash(output))    @property_hash.dup
  end

One solution would be to extend propery_hash with a list of versions in :extra_versions and adapt instances/query/insync? rpm implementations to use the :extra_versions. The solution looks more like a hack and also not clear how the multi-version packages will get removed/updated using puppet.

 

Ciprian Badescu (JIRA)

unread,
Jun 26, 2019, 9:40:02 AM6/26/19
to puppe...@googlegroups.com

Ciprian Badescu (JIRA)

unread,
Jun 26, 2019, 9:41:02 AM6/26/19
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Jul 10, 2019, 4:11:10 AM7/10/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - 2019-06-25, PR - 2019-07-10 , PR - 2019-07-23

Mihai Buzgau (JIRA)

unread,
Jul 24, 2019, 4:31:08 AM7/24/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - 2019-06-25, PR - 2019-07-10, PR - 2019-07-23 , NW - 2019-08-07

Mihai Buzgau (JIRA)

unread,
Aug 7, 2019, 4:38:08 AM8/7/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - 2019-06-25, PR - 2019-07-10, PR - 2019-07-23, NW - 2019-08-07 , NW - 2019-08-21

Mihai Buzgau (JIRA)

unread,
Aug 21, 2019, 5:17:07 AM8/21/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - 2019-06-25, PR - 2019-07-10, PR - 2019-07-23, NW - 2019-08-07, NW - 2019-08-21 , NW - 2019-09-03

Dorin Pleava (JIRA)

unread,
Sep 11, 2019, 9:50:03 AM9/11/19
to puppe...@googlegroups.com

Jean Bond (JIRA)

unread,
Sep 16, 2019, 4:10:03 PM9/16/19
to puppe...@googlegroups.com
Jean Bond updated an issue
Change By: Jean Bond
Labels: needs_repro resolved-issue-added

George Mrejea (JIRA)

unread,
Oct 3, 2019, 7:22:11 AM10/3/19
to puppe...@googlegroups.com
George Mrejea updated an issue
Change By: George Mrejea
Fix Version/s: PUP 6.4.4
Fix Version/s: PUP 5.5.17
Reply all
Reply to author
Forward
0 new messages