module-puppetlabs-apt/manifests/force.pp
Matthaus Litteken f759bc039a (#11953) Apt::force passes $version to aptitude
Previously, even if $version were passed to apt::force, aptitude would just
install the default version of the package available. This updates the aptitude
call to use the version string if it exists. If no version is passed, or if it
is false, no version is added to the aptitude call.  This also updates the
rspec-puppet tests for the define, to reflect the changes to the exec.
2012-01-13 15:29:47 -08:00

21 lines
476 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}",
}
exec { "/usr/bin/aptitude -y -t ${release} install ${name}${version_string}":
unless => $version ? {
false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'",
default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'"
}
}
}