Bug #2999

Absent package problem on Solaris

Added by Mark Plaksin 7 months ago. Updated 3 months ago.

Status:Closed Start:01/01/2010
Priority:Normal Due date:
Assigned to:Markus Roberts % Done:

0%

Category:package
Target version:0.25.2
Affected version:0.25.2rc3 Branch:http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/2999
Keywords:
Votes: 0

Description

On Solaris 9 and 10 this puppet code causes an error when puppetd runs:

package { TSSalert-sysadmin: ensure => absent, }

The package is not installed and the backtrace I get is:

/home/happy/puppet.git/lib/puppet/util.rb:214:in execpipe' /home/happy/puppet.git/lib/puppet/provider/package/sun.rb:94:ininfo2hash' /home/happy/puppet.git/lib/puppet/provider/package/sun.rb:147:in query' /home/happy/puppet.git/lib/puppet/provider/package.rb:22:inproperties' /home/happy/puppet.git/lib/puppet/type/package.rb:310:in retrieve' /home/happy/puppet.git/lib/puppet/type.rb:726:inevaluate' /home/happy/puppet.git/lib/puppet/transaction.rb:62:in apply' /home/happy/puppet.git/lib/puppet/transaction.rb:251:ineval_children_and_apply_resource' /home/happy/puppet.git/lib/puppet/util.rb:400:in thinmark' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:293:inmeasure' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:307:in realtime' /home/happy/puppet.git/lib/puppet/util.rb:399:inthinmark' /home/happy/puppet.git/lib/puppet/transaction.rb:250:in eval_children_and_apply_resource' /home/happy/puppet.git/lib/puppet/transaction.rb:207:ineval_resource' /home/happy/puppet.git/lib/puppet/transaction.rb:296:in evaluate' /home/happy/puppet.git/lib/puppet/util.rb:400:inthinmark' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:293:in measure' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:307:inrealtime' /home/happy/puppet.git/lib/puppet/util.rb:399:in thinmark' /home/happy/puppet.git/lib/puppet/transaction.rb:295:inevaluate' /home/happy/puppet.git/lib/puppet/transaction.rb:289:in collect' /home/happy/puppet.git/lib/puppet/transaction.rb:289:inevaluate' /home/happy/puppet.git/lib/puppet/resource/catalog.rb:142:in apply' /home/happy/puppet.git/lib/puppet/configurer.rb:153:inrun' /home/happy/puppet.git/lib/puppet/util.rb:178:in benchmark' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:293:inmeasure' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:307:in realtime' /home/happy/puppet.git/lib/puppet/util.rb:177:inbenchmark' /home/happy/puppet.git/lib/puppet/configurer.rb:152:in run' /home/happy/puppet.git/lib/puppet/agent.rb:53:inrun' /home/happy/puppet.git/lib/puppet/agent/locker.rb:21:in lock' /home/happy/puppet.git/lib/puppet/agent.rb:53:inrun' /opt/TWWfsw/ruby18/lib/ruby/sync.rb:229:in synchronize' /home/happy/puppet.git/lib/puppet/agent.rb:53:inrun' /home/happy/puppet.git/lib/puppet/agent.rb:130:in with_client' /home/happy/puppet.git/lib/puppet/agent.rb:51:inrun' /home/happy/puppet.git/lib/puppet/application/puppetd.rb:103:in onetime' /home/happy/puppet.git/lib/puppet/application.rb:226:insend' /home/happy/puppet.git/lib/puppet/application.rb:226:in run_command' /home/happy/puppet.git/lib/puppet/application.rb:217:inrun' /home/happy/puppet.git/lib/puppet/application.rb:306:in exit_on_fail' /home/happy/puppet.git/lib/puppet/application.rb:217:inrun' sbin/puppetd:159 /home/happy/puppet.git/lib/puppet/provider/package/sun.rb:116:in info2hash' /home/happy/puppet.git/lib/puppet/provider/package/sun.rb:147:inquery' /home/happy/puppet.git/lib/puppet/provider/package.rb:22:in properties' /home/happy/puppet.git/lib/puppet/type/package.rb:310:inretrieve' /home/happy/puppet.git/lib/puppet/type.rb:726:in evaluate' /home/happy/puppet.git/lib/puppet/transaction.rb:62:inapply' /home/happy/puppet.git/lib/puppet/transaction.rb:251:in eval_children_and_apply_resource' /home/happy/puppet.git/lib/puppet/util.rb:400:inthinmark' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:293:in measure' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:307:inrealtime' /home/happy/puppet.git/lib/puppet/util.rb:399:in thinmark' /home/happy/puppet.git/lib/puppet/transaction.rb:250:ineval_children_and_apply_resource' /home/happy/puppet.git/lib/puppet/transaction.rb:207:in eval_resource' /home/happy/puppet.git/lib/puppet/transaction.rb:296:inevaluate' /home/happy/puppet.git/lib/puppet/util.rb:400:in thinmark' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:293:inmeasure' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:307:in realtime' /home/happy/puppet.git/lib/puppet/util.rb:399:inthinmark' /home/happy/puppet.git/lib/puppet/transaction.rb:295:in evaluate' /home/happy/puppet.git/lib/puppet/transaction.rb:289:incollect' /home/happy/puppet.git/lib/puppet/transaction.rb:289:in evaluate' /home/happy/puppet.git/lib/puppet/resource/catalog.rb:142:inapply' /home/happy/puppet.git/lib/puppet/configurer.rb:153:in run' /home/happy/puppet.git/lib/puppet/util.rb:178:inbenchmark' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:293:in measure' /opt/TWWfsw/ruby18/lib/ruby/benchmark.rb:307:inrealtime' /home/happy/puppet.git/lib/puppet/util.rb:177:in benchmark' /home/happy/puppet.git/lib/puppet/configurer.rb:152:inrun' /home/happy/puppet.git/lib/puppet/agent.rb:53:in run' /home/happy/puppet.git/lib/puppet/agent/locker.rb:21:inlock' /home/happy/puppet.git/lib/puppet/agent.rb:53:in run' /opt/TWWfsw/ruby18/lib/ruby/sync.rb:229:insynchronize' /home/happy/puppet.git/lib/puppet/agent.rb:53:in run' /home/happy/puppet.git/lib/puppet/agent.rb:130:inwith_client' /home/happy/puppet.git/lib/puppet/agent.rb:51:in run' /home/happy/puppet.git/lib/puppet/application/puppetd.rb:103:inonetime' /home/happy/puppet.git/lib/puppet/application.rb:226:in send' /home/happy/puppet.git/lib/puppet/application.rb:226:inrun_command' /home/happy/puppet.git/lib/puppet/application.rb:217:in run' /home/happy/puppet.git/lib/puppet/application.rb:306:inexit_on_fail' /home/happy/puppet.git/lib/puppet/application.rb:217:in `run' sbin/puppetd:159 err: //gaview/Alert_sysadmin::Config[pig]/Package[TSSalert-sysadmin]: Failed to retrieve current state of resource: Unable to get information about package TSSalert-sysadmin because of: ERROR: information for “TSSalert-sysadmin” was not found

This happens regardless of the package name—any package that is both “absented” and not installed causes this backtrace. If it helps, running ‘/usr/bin/pkginfo -l TSSalert-sysadmin’ returns this with an exit status of 1:

ERROR: information for "TSSalert-sysadmin" was not found

Related issues

related to Puppet - Bug #2940: Package resource with ensure=>latest and invalid source g... Closed 12/16/2009
related to Puppet - Refactor #3000: Normalize package providers' treatment of absent packages Accepted 01/02/2010

History

Updated by James Turnbull 7 months ago

  • Category set to package
  • Status changed from Unreviewed to Accepted
  • Assigned to set to Markus Roberts
  • Target version set to 0.25.2

Updated by Markus Roberts 7 months ago

  • Status changed from Accepted to Needs design decision

So the best answer is probably to go for compatibility with other providers. What do they do?

  • *bsd propogate error or return nil

  • appdmg, apple, pkgdmg no tool call (direct file system check), so not directly analogous return nil

  • blastwave: Puppet.warning “Cannot match %s” % line return {:ensure => :absent}

  • darwin port: raise Puppet::DevError,“Failed to match dpkg line %s” % line

  • dpkg: return {:ensure => :purged, :status => ‘missing’, :name => @resource[:name], :error => ‘ok’}

  • gem Puppet.warning “Could not match %s” % desc return nil

  • hpux return {:ensure => :absent}

  • portage: raise Puppet::Error.new(“No package found with the specified name [#{not_found_value}]”)

  • ports, rpm, rug, up2date, urpmi, yum return nil

So it looks like the most popular answer is to return nil (which could manifest an analog of #2940); the second most popular is raising/propagating an error (which is what it does now). I think my favorite would be {:ensure => :absent} but I’m unclear why this isn’t being done more often.

Updated by Markus Roberts 7 months ago

  • Status changed from Needs design decision to Ready for Testing
  • Branch set to http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/2999

It appears (I don’t have a sun box to test on) that returning {:ensure => :absent} in the specific case of an uninstalled package will fix the behaviour without introducing a regression on #2940.

There’s a branch which does this up for testing at http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/2999

Updated by Mark Plaksin 7 months ago

The branch resolves the problem on both Solaris 9 and 10.

Updated by James Turnbull 7 months ago

  • Status changed from Ready for Testing to Closed

Pushed in commit:“e7d98ccbc0021bace65dd8525e730462947e5049” in branch 0.25.x

Also available in: Atom PDF