Puppet: System Administration Automated

Support

Ticket #1224 (closed defect: fixed)

Opened 8 months ago

Last modified 8 months ago

rpm provider fails when using 'ensure => latest' due to errant method scoping

Reported by: technogeeky Assigned to: community
Priority: high Milestone:
Component: package Version: 0.24.4
Severity: normal Keywords: rpm nevra nevra_to_hash provider package
Cc: chadh, thegcat Triage Stage: Unreviewed
Attached Patches: Code Complexity: Trivial

Description

The simplest package resource using the RPM provider fails:

    package { "core":
        ensure => latest,
        provider => rpm,
        source => "/tmp/core.rpm",
    }

This code fails to execute with an error message:

err: //Node[base]/Package[core]/ensure: change from absent to latest failed: Could not update: undefined method `nevra_to_hash' for #<Puppet::Type::Package::ProviderRpm:0x7fc63a824b20>

Looking at the source code, I noticed that the method nevra_to_hash is defined as "self.nevra_to_hash(...)". While some places in the rpm.rb file call the function directly (nevra_to_hash(...)), others call the function as a class method (self.class.nevra_to_hash(...)). It appears that the former case is callable only in other class methods, while object methods use the latter call.

Attached is a simple, one-line patch.

Attachments

rpm.rb.patch (0.7 kB) - added by technogeeky on 05/15/08 16:37:02.
providers/package/rpm.rb

Change History

05/15/08 16:37:02 changed by technogeeky

  • attachment rpm.rb.patch added.

providers/package/rpm.rb

05/15/08 16:40:54 changed by technogeeky

  • priority changed from normal to high.
  • complexity changed from Unknown to Trivial.
  • component changed from Debian to package.

05/16/08 09:18:30 changed by jamtur01

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in commit [2d6a914e6071681b83e482b40448d9219d6e4d76] in branch 0.24.x