Tuesday, September 25, 2007

Yum behaviour change

When you want to ensure you have the latest version of a package installed, you would configure puppet as follows:

package { "ypbind":
ensure => latest
}

What puppet does, is execute yum as follows:

yum -d 0 -e 0 list available ypbind

If it gets any hits, the package is either available for installation, or eligible for an update, so it'll install the available package. If no packages are "available", it'll just continue like normal.

You will most likely have some file or service definitions depending on the "availability" of the package:

file { "/etc/yp.conf":
source => "puppet://$server/files/yp.conf",
require => Package["ypbind"]
}

service { "ypbind":
ensure => running,
require => Package["ypbind"]
}

When puppet ensures the package to be installed before executing any of the depending definitions, it assumes that yum exiting without any error code is equivalent to the (the most recent version of the) package being installed on the system, and any error code means it can't be done (and thus: not execute the depending statements).

Lately however, yum does throw an error code if there is no package "available" (for installation), and thus all puppet dependencies for that package fail.

No comments: