Refactor #3000

Normalize package providers' treatment of absent packages

Added by Markus Roberts about 2 years ago. Updated 21 days ago.

Status:Accepted Start date:01/02/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:package
Target version:Telly
Affected Puppet version:0.25.2 Branch:
Keywords:
Votes: 1

Description

It appears that there is no consensus on how package providers should deal with an attempt to query an absent package.

At present:

*  *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

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 #2999). I think my favorite would be {:ensure => :absent} but I’m unclear why this isn’t being done more often.


Related issues

related to Puppet - Bug #2999: Absent package problem on Solaris Closed 01/01/2010
related to Puppet - Bug #4799: portage provider incorrectly fails when eix finds no pack... Code Insufficient 09/17/2010

History

Updated by James Turnbull about 2 years ago

  • Status changed from Unreviewed to Needs Decision
  • Affected Puppet version changed from 0.25.1 to 0.25.2

Updated by Luke Kanies about 2 years ago

  • Status changed from Needs Decision to Accepted

Seems like a great idea, although I might be tempted to move it to rowlf given that it’s not so much a bug fix as a refactor.

Updated by Markus Roberts about 2 years ago

  • Target version changed from 0.25.3 to 0.25.4

Updated by James Turnbull about 2 years ago

  • Target version changed from 0.25.4 to 0.25.5

Updated by James Turnbull almost 2 years ago

  • Target version changed from 0.25.5 to 49

Updated by James Turnbull over 1 year ago

  • Target version changed from 49 to 2.7.x

Updated by Lance Albertson over 1 year ago

To me this is more of a bug than just a refactor. In the case of the portage provider, it should not error and fail the resource if I’m ensuring a package is absent if the package is not found by eix.

Updated by Ben Hughes 22 days ago

  • Description updated (diff)
  • Status changed from Accepted to Unreviewed

Updated by Michael Stahnke 21 days ago

  • Description updated (diff)
  • Status changed from Unreviewed to Accepted
  • Target version changed from 2.7.x to Telly

Still valid.

Also available in: Atom PDF