The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #12052

No error message printed if package installation fails due to broken dependencies

Added by Thomas Nygreen over 2 years ago. Updated over 2 years ago.

Status:AcceptedStart date:01/20/2012
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:package
Target version:-
Affected Puppet version:2.7.9 Branch:
Keywords:aptitude debian

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket may be automatically exported to the PUP project on JIRA using the button below:


Description

When using a package statement to install a package, and that package has broken dependencies, puppet continues without printing an error message. I found out that aptitude -y install package-name returns a 0 exit status code even if the package name does not exist, or the package has broken dependencies. Puppet already reads the output from aptitude to check for the first case, but misses the case with broken dependencies.

Instead of searching for /Couldn’t find any package/ in the output from aptitude, the install routine should check if the package was actually installed, using something like dpkg-query -W -f=‘${Status}’ package-name

History

#1 Updated by Dominic Cleal over 2 years ago

  • Status changed from Unreviewed to Needs Decision
  • Target version set to 2.7.x
  • Affected Puppet version set to 2.7.9
  • Keywords set to aptitude debian

I think first that a bug should be filed against aptitude itself, similar to #233129 which fixed the exit code of “aptitude update”:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=233129

Perhaps also it should be addressed at a higher level in Puppet, either in the type or elsewhere to ensure the ‘ensure’ property is now in-sync?

#2 Updated by Dominic Cleal over 2 years ago

  • Target version deleted (2.7.x)

#3 Updated by Daniel Pittman over 2 years ago

  • Status changed from Needs Decision to Accepted

This seems like a solid change; inspecting the output to give better error messages is fine, but if we can’t trust the exit code we better check another way before assuming it succeeded.

#4 Updated by Thomas Nygreen over 2 years ago

Dominic Cleal wrote:

I think first that a bug should be filed against aptitude itself,

I have filed a bug report against aptitude at [1], but it looks like aptitude is keen on returning 0, no matter what happens, so I don’t think one should rely on that exit status code.

Perhaps also it should be addressed at a higher level in Puppet, either in the type or elsewhere to ensure the ‘ensure’ property is now in-sync?

The logical interpretation of ‘ensure present’ or ‘ensure latest’ is that puppet should actually ensure that the package is installed. So I think that checking with dpkg makes sense anyway.

[1] https://bugs.launchpad.net/ubuntu/+source/aptitude/+bug/919216

Also available in: Atom PDF