Skip to content

Commit 1294109

Browse files
committed
MODULES-10763 Do not report apt-get update as a change
1 parent ee98a5a commit 1294109

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

manifests/update.pp

+12-3
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,22 @@
5656
} else {
5757
$_refresh = true
5858
}
59+
$apt_update_successful = @("ASH"/$)
60+
for try in \$(seq ${apt::_update['tries']} -1 1); do
61+
timeout ${apt::_update['timeout']} ${apt::provider} update && exit 0
62+
[ \$try -eq 1 ] && exit \$?
63+
sleep 1
64+
done
65+
- ASH
5966
exec { 'apt_update':
60-
command => "${apt::provider} update",
67+
command => "echo ${apt::provider} update FAILED",
6168
loglevel => $apt::_update['loglevel'],
6269
logoutput => 'on_failure',
70+
path => '/bin:/usr/bin',
71+
provider => shell,
6372
refreshonly => $_refresh,
73+
returns => [-1], # This ensures a run-time failure.
6474
timeout => $apt::_update['timeout'],
65-
tries => $apt::_update['tries'],
66-
try_sleep => 1,
75+
unless => $apt_update_successful,
6776
}
6877
}

spec/classes/apt_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@
267267

268268
it {
269269
is_expected.to contain_exec('apt_update').with(refreshonly: false,
270-
timeout: 1,
271-
tries: 3)
270+
timeout: 1)
272271
}
273272
end
274273

0 commit comments

Comments
 (0)