-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from jhoblitt/feature/puppet_helper_num_execu…
…tors Feature/puppet helper num executors
- Loading branch information
Showing
10 changed files
with
363 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# == Define: jenkins::cli::exec | ||
# | ||
# A defined type for executing custom helper script commands via the Jenkins | ||
# CLI. | ||
# | ||
define jenkins::cli::exec( | ||
$command = $title, | ||
$unless = undef, | ||
) { | ||
if !(is_string($command) or is_array($command)) { | ||
fail('$command is not a string or an Array.') | ||
} | ||
validate_string($unless) | ||
|
||
include ::jenkins | ||
include ::jenkins::cli_helper | ||
include ::jenkins::cli::reload | ||
|
||
# $command may be either a string or an array due to the use of flatten() | ||
$run = join( | ||
delete_undef_values( | ||
flatten([ | ||
$::jenkins::cli_helper::helper_cmd, | ||
$command | ||
]) | ||
), | ||
' ' | ||
) | ||
|
||
if $unless { | ||
$environment_run = [ "HELPER_CMD=${::jenkins::cli_helper::helper_cmd}" ] | ||
} else { | ||
$environment_run = undef | ||
} | ||
|
||
exec { $title: | ||
provider => 'shell', | ||
command => $run, | ||
environment => $environment_run, | ||
unless => $unless, | ||
tries => $::jenkins::cli_tries, | ||
try_sleep => $::jenkins::cli_try_sleep, | ||
notify => Class['jenkins::cli::reload'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.