f759bc039a
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.
21 lines
476 B
Puppet
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}'"
|
|
}
|
|
}
|
|
|
|
}
|