{"record":{"id":"44b4c6d0f3a630bb","repo":"puppetlabs/puppet","slug":"unable-to-get-information-about-package-name-be","errorCode":null,"errorMessage":"Unable to get information about package %{name} because of: %{errmsg}","messagePattern":"Unable to get information about package %(.+?) because of: %(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/sun.rb","lineNumber":82,"sourceCode":"\n  # Get info on a package, optionally specifying a device.\n  def info2hash(device = nil)\n    args = ['-l']\n    args << '-d' << device if device\n    args << @resource[:name]\n    begin\n      pkgs = self.class.parse_pkginfo(pkginfo(*args))\n      errmsg = case pkgs.size\n               when 0\n                 'No message'\n               when 1\n                 pkgs[0]['ERROR']\n               end\n      return self.class.namemap(pkgs[0]) if errmsg.nil?\n\n      # according to commit 41356a7 some errors do not raise an exception\n      # so even though pkginfo passed, we have to check the actual output\n      raise Puppet::Error, _(\"Unable to get information about package %{name} because of: %{errmsg}\") % { name: @resource[:name], errmsg: errmsg }\n    rescue Puppet::ExecutionFailure\n      { :ensure => :absent }\n    end\n  end\n\n  # Retrieve the version from the current package file.\n  def latest\n    info2hash(@resource[:source])[:ensure]\n  end\n\n  def query\n    info2hash\n  end\n\n  # only looking for -G now\n  def install\n    # TRANSLATORS Sun refers to the company name, do not translate\n    raise Puppet::Error, _(\"Sun packages must specify a package source\") unless @resource[:source]","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/sun.rb#L64-L100","documentation":"The Solaris sun provider's info2hash parses 'pkginfo -l [-d device] <name>' output; when parsing yields zero records ('No message') or a single record carrying an ERROR stanza, it raises Puppet::Error embedding that pkginfo error text. Normal execution failures are rescued into {ensure: :absent} - this error fires only when pkginfo 'succeeds' but reports an error in its payload, most often for a bad -d device when computing latest.","triggerScenarios":"ensure => latest (latest calls info2hash(@resource[:source]) with -d <source>) where the source device path is wrong, not a valid package datastream/spool, or the package name is not PKGINST inside it; pkginfo writes ERROR lines while exiting 0 (commit 41356a7 behavior).","commonSituations":"source pointing at a directory that lacks the package stream; corrupt .pkg files; stale NFS mounts; Solaris 10 sparse zones with inherited /var/sadm.","solutions":["Run exactly what the provider runs: 'pkginfo -l -d <source> <name>' and read the ERROR text echoed in %{errmsg}","Fix source to a valid package datastream file or spool directory the package actually resides in","List source contents with 'pkginfo -d <source>' (no name) to confirm the PKGINST spelling","For ensure => latest confirm the source carries a newer VERSION than installed"],"exampleFix":"// before - source directory does not contain the package stream\npackage { 'SUNWfoo':\n  ensure   => latest,\n  provider => sun,\n  source   => '/export/pkgs',\n}\n// after - point at the datastream file itself\npackage { 'SUNWfoo':\n  ensure   => latest,\n  provider => sun,\n  source   => '/export/pkgs/SUNWfoo-1.0.pkg',\n}","handlingStrategy":"try-catch","validationCode":"# Ruby: check pkginfo can read the source device before asking for latest\ndef pkginfo_source_readable?(name, device)\n  out = Puppet::Util::Execution.execute(['/usr/bin/pkginfo', '-l', '-d', device, name], failonfail: false).to_s\n  out !~ /ERROR:/ && !out.strip.empty?\nend","typeGuard":null,"tryCatchPattern":"begin\n  info = provider.info2hash(resource[:source])\nrescue Puppet::Error => e\n  raise unless e.message =~ /Unable to get information about package/\n  Puppet.err(\"pkginfo reported: #{e.message}\")\n  info = { ensure: :absent }\nend","preventionTips":["Validate .pkg datastreams with 'pkginfo -d <file>' in CI before shipping modules","Keep Solaris package sources on stable, mounted paths","Use an adminfile so pkgadd runs non-interactively and errors surface immediately"],"tags":["solaris","pkginfo","pkgadd","package-metadata","package-provider"],"backgroundTag":"package-query-failed","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}