- exec { "/usr/bin/apt-get -y -t ${release} install ${name}${version_string}":
- unless => $install_check,
- logoutput => 'on_failure',
- timeout => $timeout,
+
+ 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'"
+ } else {
+ # If installed version and candidate version differ, this check returns 1 (false).
+ $install_check = "/usr/bin/test \$(/usr/bin/apt-cache policy -t ${release} ${name} | /bin/grep -E 'Installed|Candidate' | /usr/bin/uniq -s 14 | /usr/bin/wc -l) -eq 1"
+ }
+ } else {
+ if $release == false {
+ $install_check = "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'"
+ } else {
+ $install_check = "/usr/bin/apt-cache policy -t ${release} ${name} | /bin/grep -q 'Installed: ${version}'"
+ }
+ }
+
+ 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,