Skip to content

Commit

Permalink
move Exec['reload-jenkins'] from jenkins::cli -> jenkins::cli::reload
Browse files Browse the repository at this point in the history
Due to resource containment, it was not possible for a consumer of
`jenkins::cli` to both have a dependency on `Class['jenkins::cli']` and to
notify `Exec['reload-jenkins']`.  It is recommended that notifications be
instead be sent to `Class['jenkins::cli::reload']` to ease any future
refactoring.
  • Loading branch information
Joshua Hoblitt authored and jhoblitt committed May 2, 2015
1 parent df133b4 commit 979cb01
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
10 changes: 0 additions & 10 deletions manifests/cli.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 19 additions & 0 deletions manifests/cli/reload.pp
Original file line number Diff line number Diff line change
@@ -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,
}
}
6 changes: 4 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@

if $cli {
include jenkins::cli
include jenkins::cli::reload
}

Anchor['jenkins::begin'] ->
Expand All @@ -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 {
Expand Down

0 comments on commit 979cb01

Please # to comment.