Defined Type: jenkins::cli::exec
- Defined in:
- manifests/cli/exec.pp
Overview
Define: jenkins::cli::exec
A defined type for executing custom helper script commands via the Jenkins CLI.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'manifests/cli/exec.pp', line 6
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
Class['jenkins::cli_helper'] ->
Jenkins::Cli::Exec[$title] ->
Anchor['jenkins::end']
# $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'],
}
}
|