module-puppetlabs-apt/manifests/force.pp
Nan Liu 2dcec036ca Add logoutput on_failure for all exec resources.
We need more information to debug issues on exec failure. This change
enables logouput => on_failure.
2012-06-07 14:53:41 -07:00

22 lines
543 B
Puppet

# force.pp
# force a package from a specific release
define apt::force(
$release = 'testing',
$version = false
) {
$version_string = $version ? {
false => undef,
default => "=${version}",
}
$install_check = $version ? {
false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'",
default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'",
}
exec { "/usr/bin/aptitude -y -t ${release} install ${name}${version_string}":
unless => $install_check,
logoutput => 'on_failure',
}
}