X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fforce.pp;h=8ceeb17060a57cf68d50a6681542cde134ecd7ce;hb=90cc951753edeb3380b0ee6193c4d6febdc84a18;hp=152bb67354db6fa8960a20a942329f0cf5d7b147;hpb=fd3e07e58fadc6efb25d524168575c39de0c5590;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/force.pp b/manifests/force.pp index 152bb67..8ceeb17 100644 --- a/manifests/force.pp +++ b/manifests/force.pp @@ -2,11 +2,16 @@ # force a package from a specific release define apt::force( - $release = false, - $version = false, - $timeout = 300 + $release = false, + $version = false, + $timeout = 300, + $cfg_files = 'none', + $cfg_missing = false, ) { + validate_re($cfg_files, ['^new', '^old', '^unchanged', '^none']) + validate_bool($cfg_missing) + $provider = $apt::params::provider $version_string = $version ? { @@ -19,6 +24,18 @@ define apt::force( default => "-t ${release}", } + case $cfg_files { + 'new': { $config_files = '-o Dpkg::Options::="--force-confnew"' } + 'old': { $config_files = '-o Dpkg::Options::="--force-confold"' } + 'unchanged': { $config_files = '-o Dpkg::Options::="--force-confdef"' } + 'none', default: { $config_files = '' } + } + + case $cfg_missing { + true: { $config_missing = '-o Dpkg::Options::="--force-confmiss"' } + false, default: { $config_missing = '' } + } + if $version == false { if $release == false { $install_check = "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'" @@ -34,9 +51,10 @@ define apt::force( } } - exec { "${provider} -y ${release_string} install ${name}${version_string}": - unless => $install_check, - logoutput => 'on_failure', - timeout => $timeout, + exec { "${provider} -y ${config_files} ${config_missing} ${release_string} install ${name}${version_string}": + unless => $install_check, + environment => ['LC_ALL=C', 'LANG=C'], + logoutput => 'on_failure', + timeout => $timeout, } }