From 09750a11df16d8979a9b481a57d3b5c60e0d9f9b Mon Sep 17 00:00:00 2001 From: Ian Tewksbury Date: Wed, 10 Aug 2016 08:34:33 -0400 Subject: [PATCH] Issue #108: jboss_admin::cleanup - add ability to control the number of reload and/or restart attempts --- manifests/cleanup.pp | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/manifests/cleanup.pp b/manifests/cleanup.pp index c545db6..e029f46 100644 --- a/manifests/cleanup.pp +++ b/manifests/cleanup.pp @@ -2,26 +2,40 @@ # # Reloads or restarts the jboss container if needed. # +# @param server jboss_admin::server to cleanup +# @param wait_for_up_tries Number of attempts to try for JBoss EAP to be back up after a +# reload or restart. +# @param wait_for_up_try_sleep Seconds to wait between checks for JBoss EAP to be back up after a +# reload or restart. +# @param wait_for_reload_or_restart_tries If reload or restart is required, number of attempts to to try to +# perform reload or restart of JBoss EAP. +# @param wait_for_reload_or_restart_try_sleep If reload or restart is required, seconds to wait between attempts. define jboss_admin::cleanup( $server, - $wait_for_up_tries = 10, - $wait_for_up_try_sleep = 1, - $noop = false, + $wait_for_up_tries = 10, + $wait_for_up_try_sleep = 1, + $wait_for_reload_or_restart_tries = 10, + $wait_for_reload_or_restart_try_sleep = 1, + $noop = false, ) { jboss_exec{"Reload Server ${name}": - command => ':reload', - onlyif => '(response-headers.process-state == reload-required) of :whoami', - notify => Jboss_exec["Check Server Up After ${name}"], - server => $server, - noop => $noop, + command => ':reload', + onlyif => '(response-headers.process-state == reload-required) of :whoami', + tries => $wait_for_reload_or_restart_tries, + try_sleep => $wait_for_reload_or_restart_try_sleep, + notify => Jboss_exec["Check Server Up After ${name}"], + server => $server, + noop => $noop, } -> jboss_exec{"Restart Server ${name}": - command => ':shutdown(restart=true)', - onlyif => '(response-headers.process-state == restart-required) of :whoami', - notify => Jboss_exec["Check Server Up After ${name}"], - server => $server, - noop => $noop, + command => ':shutdown(restart=true)', + onlyif => '(response-headers.process-state == restart-required) of :whoami', + tries => $wait_for_reload_or_restart_tries, + try_sleep => $wait_for_reload_or_restart_try_sleep, + notify => Jboss_exec["Check Server Up After ${name}"], + server => $server, + noop => $noop, } -> jboss_exec{"Check Server Up After ${name}":