X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=manifests%2Fforce.pp;h=75634b476dd8fe7cac2517cbdbefcc89b758dc13;hb=ffb89f6d5d806a27ad43129f5e74fdd7033bd2f3;hp=ece532acd0578ac740eba49c324e3b1a559cdbbe;hpb=2f5d317177976043dc3480ff715da5e1e56b8957;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/force.pp b/manifests/force.pp index ece532a..75634b4 100644 --- a/manifests/force.pp +++ b/manifests/force.pp @@ -3,14 +3,22 @@ define apt::force( $release = 'testing', - $version = false + $version = false, + $timeout = 300 ) { - exec { "/usr/bin/aptitude -y -t ${release} install ${name}": - unless => $version ? { - false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'", - default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${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', + timeout => $timeout, + } }