Skip to content

Commit

Permalink
MODULES-10763 Do not report apt-get update as a change
Browse files Browse the repository at this point in the history
  • Loading branch information
pillarsdotnet committed Dec 19, 2022
1 parent ee98a5a commit de12063
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
15 changes: 12 additions & 3 deletions manifests/update.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,22 @@
} else {
$_refresh = true
}
$apt_update_successful = @("ASH"/$)
for try in \$(seq ${apt::_update['tries']} -1 1); do
timeout ${apt::_update['timeout']} ${apt::provider} update && exit 0
[ \$try -eq 1 ] && exit \$?
sleep 1
done
- ASH
exec { 'apt_update':
command => "${apt::provider} update",
command => "echo ${apt::provider} update FAILED",
loglevel => $apt::_update['loglevel'],
logoutput => 'on_failure',
path => '/bin:/usr/bin',
provider => shell,
refreshonly => $_refresh,
returns => [-1], # This ensures a run-time failure.
timeout => $apt::_update['timeout'],
tries => $apt::_update['tries'],
try_sleep => 1,
unless => $apt_update_successful,
}
}
6 changes: 2 additions & 4 deletions spec/classes/apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@

it {
is_expected.to contain_exec('apt_update').with(refreshonly: false,
timeout: 1,
tries: 3)
timeout: 1)
}
end

Expand Down Expand Up @@ -307,8 +306,7 @@

it {
is_expected.to contain_exec('apt_update').with(refreshonly: false,
timeout: 1,
tries: 3)
timeout: 1)
}
end

Expand Down

0 comments on commit de12063

Please sign in to comment.