X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fforce.pp;h=d3d5962d0889a5975c81d62b8acd468015319ea2;hb=14b2eb1ca0ce3886478fcc0b23794237cd387de5;hp=564ed75ff4db02fabc6214b2a1c5434e6c100f61;hpb=71fc4251767bc4784769aead6a6273250359dbe2;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/force.pp b/manifests/force.pp index 564ed75..d3d5962 100644 --- a/manifests/force.pp +++ b/manifests/force.pp @@ -2,15 +2,21 @@ # force a package from a specific release define apt::force( - $release = 'testing', - $version = false + $release = 'testing', + $version = false ) { - exec { "/usr/bin/aptitude -y -t ${release} install ${name}": - unless => $version ? { - false => "/usr/bin/dpkg -l | grep ${name}", - default => "/usr/bin/dpkg -l | grep ${name} | grep ${version}" - } - } + $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', + } }