{"record":{"id":"dcbfba795af42684","repo":"puppetlabs/puppet","slug":"e-message","errorCode":null,"errorMessage":"e.message","messagePattern":"e\\.message","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/rpm.rb","lineNumber":121,"sourceCode":"      end\n    end\n    @property_hash.update(self.class.nevra_to_multiversion_hash(output))\n\n    @property_hash.dup\n  end\n\n  # Here we just retrieve the version from the file specified in the source.\n  def latest\n    source = @resource[:source]\n    unless source\n      @resource.fail _(\"RPMs must specify a package source\")\n    end\n\n    cmd = [command(:rpm), \"-q\", \"--qf\", self.class::NEVRA_FORMAT.to_s, \"-p\", source]\n    h = self.class.nevra_to_multiversion_hash(execute(cmd))\n    h[:ensure]\n  rescue Puppet::ExecutionFailure => e\n    raise Puppet::Error, e.message, e.backtrace\n  end\n\n  def install\n    source = @resource[:source]\n    unless source\n      @resource.fail _(\"RPMs must specify a package source\")\n    end\n\n    version = @property_hash[:ensure]\n\n    # RPM gets upset if you try to install an already installed package\n    return if @resource.should(:ensure) == version || (@resource.should(:ensure) == :latest && version == latest)\n\n    flag = [\"-i\"]\n    flag = [\"-U\", \"--oldpackage\"] if version && (version != :absent && version != :purged)\n    flag += install_options if resource[:install_options]\n    rpm flag, source\n  end","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/rpm.rb#L103-L139","documentation":"A pass-through error from the rpm provider's latest: the version of the source RPM is read with 'rpm -q -p <source>' and any Puppet::ExecutionFailure is re-raised as Puppet::Error carrying the original rpm message and backtrace. The message you see is rpm's own complaint - typically 'open of <file> failed' or 'not an rpm package'.","triggerScenarios":"package { 'x': provider => rpm, ensure => latest, source => '/tmp/x.rpm' } where the file is missing, unreadable, truncated, not actually an rpm, or a URL rpm cannot fetch. Also fires for ensure => <version> comparisons that consult latest. The query at lib/puppet/provider/package/rpm.rb:117 fails and the rescue at :120 re-raises.","commonSituations":"Typo'd source paths; files misnamed .rpm (actually deb/gem); partially downloaded rpms; remote source URLs requiring auth; puppet agent lacking read permission or SELinux context on the file.","solutions":["Run 'rpm -q -p <source>' yourself - the raised message is exactly rpm's complaint; fix the path or file accordingly","Validate the file: 'file <source>' should report 'RPM v3'; re-download if size/checksum is off","Ensure the puppet process can read the file (permissions, SELinux labels on the staging directory)","If source is a URL rpm struggles with, stage it locally with a file resource first and reference the local path"],"exampleFix":"// before - typo'd/stale source path, rpm -q -p fails\npackage { 'mysvc':\n  ensure   => latest,\n  provider => rpm,\n  source   => '/opt/pkgs/mysvc-1.0.1-1.el7.rpm ',\n}\n// after - staged with checksums, correct path, explicit ordering\nfile { '/opt/pkgs/mysvc-1.0.1-1.el7.rpm':\n  ensure => file,\n  source => 'puppet:///modules/profile/mysvc-1.0.1-1.el7.rpm',\n}\npackage { 'mysvc':\n  ensure   => latest,\n  provider => rpm,\n  source   => '/opt/pkgs/mysvc-1.0.1-1.el7.rpm',\n  require  => File['/opt/pkgs/mysvc-1.0.1-1.el7.rpm'],\n}","handlingStrategy":"validation","validationCode":"# Ruby: check the source is a readable RPM before letting latest query it\nRPM_MAGIC = \"\\xED\\xAB\\xEE\\xDB\".b\ndef valid_rpm_file?(path)\n  File.readable?(path) && File.open(path, 'rb') { |f| f.read(4) == RPM_MAGIC }\nend","typeGuard":null,"tryCatchPattern":"begin\n  latest_ver = provider.latest\nrescue Puppet::Error => e\n  raise Puppet::Error, \"source rpm for #{resource[:name]} unusable: #{e.message}\" if e.message =~ /open of .* failed|not an rpm/i\n  raise\nend","preventionTips":["Stage rpms via file resources with checksums and require them from the package","Verify downloads with 'rpm -q -p <file>' in CI before publishing to the module","Keep source paths in hiera data you can lint for typos and stale versions"],"tags":["rpm","source-rpm","file-not-found","package-provider"],"backgroundTag":"rpm-query-failed","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}