diff --git a/manifests/cli.pp b/manifests/cli.pp index 4edd9060a..ede3ac8d5 100644 --- a/manifests/cli.pp +++ b/manifests/cli.pp @@ -31,16 +31,6 @@ # The jenkins cli command with required parameter(s) $cmd = "java -jar ${jar} -s http://localhost:${port}" - # Reload all Jenkins config from disk (only when notified) - exec { 'reload-jenkins': - command => "${cmd} reload-configuration", - path => ['/bin', '/usr/bin'], - tries => 10, - try_sleep => 2, - refreshonly => true, - require => File[$jar], - } - # Do a safe restart of Jenkins (only when notified) exec { 'safe-restart-jenkins': command => "${cmd} safe-restart && /bin/sleep 10", diff --git a/manifests/cli/reload.pp b/manifests/cli/reload.pp new file mode 100644 index 000000000..cf9593dca --- /dev/null +++ b/manifests/cli/reload.pp @@ -0,0 +1,19 @@ +# Class: jenkins::cli::reload +# +# Command Jenkins to reload config.xml via the CLI. +# +class jenkins::cli::reload { + + if $caller_module_name != $module_name { + fail("Use of private class ${name} by ${caller_module_name}") + } + + # Reload all Jenkins config from disk (only when notified) + exec { 'reload-jenkins': + command => "${::jenkins::cli::cmd} reload-configuration", + path => ['/bin', '/usr/bin'], + tries => 10, + try_sleep => 2, + refreshonly => true, + } +} diff --git a/manifests/init.pp b/manifests/init.pp index a57cc3e2d..eac8645f9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -199,6 +199,7 @@ if $cli { include jenkins::cli + include jenkins::cli::reload } Anchor['jenkins::begin'] -> @@ -213,8 +214,9 @@ Anchor['jenkins::begin'] -> Class['jenkins::service'] -> Class['jenkins::cli'] -> - Class['jenkins::jobs'] -> - Anchor['jenkins::end'] + Class['jenkins::cli::reload'] -> + Class['jenkins::jobs'] -> + Anchor['jenkins::end'] } if $install_java {