Skip to content

Commit 77ee1e2

Browse files
committed
Add wait function during install
* When the puppetserver has a high CPU usage normal tasks can often take longer than anticipated. If the puppetserver is not ready for requests, the puppet runs will fail and the plan fails shortly after. This calls the check_status task to determine if the puppetserver is not only up but taking requests. This will help prevent unwanted failures. This code will sleep in 5 second increments up to a total of 50 seconds. If the puppetserver hasn't calmed down by then we continue with the plan and let it fail during the puppet run.
1 parent 320b60e commit 77ee1e2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

plans/action/install.pp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,19 @@
342342
}
343343

344344
run_task('peadm::puppet_runonce', $master_target)
345+
346+
# The puppetserver might be in the middle of a restart so we check the status by calling
347+
# the api and ensuring the puppetserver is taking requests.
348+
ctrl::do_until('limit' => 10) || {
349+
$pe_status = run_task('peadm::check_status', $master_target, service => 'pe-master')
350+
if ($pe_status.first['state'] != 'running') {
351+
ctrl::sleep(5)
352+
false
353+
} else {
354+
true
355+
}
356+
}
357+
345358
run_task('peadm::puppet_runonce', $all_targets - $master_target)
346359

347360
return("Installation of Puppet Enterprise ${arch['architecture']} succeeded.")

0 commit comments

Comments
 (0)