Skip to content

Commit ef71fc6

Browse files
committed
(maint) run plan: Allow environment and noop option
1 parent efff4eb commit ef71fc6

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

plans/run.pp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Starts a Puppet agent run on the specified targets.
22
# Note: This plan may cause issues when run in Puppet Enterprise.
33
# @param targets The targets to start a Puppet agent run on.
4+
# @param noop if true, all runs will use --noop
5+
# @param environment the desired puppet code environment
46
plan puppet_agent::run (
5-
TargetSpec $targets
7+
TargetSpec $targets,
8+
Boolean $noop = false,
9+
Optional[String[1]] $environment = undef,
610
) {
711
# Check which targets have the agent installed by checking
812
# the version of the agent. No point in trying to run the
@@ -53,11 +57,20 @@
5357
}
5458

5559
# Run the agent on all targets that have the agent installed.
60+
$arg_env = $environment ? {
61+
Undef => {},
62+
default => {'environment' => $environment, },
63+
}
64+
$arg_noop = $noop ? {
65+
true => { 'noop' => true, },
66+
default => {},
67+
}
68+
$args = $arg_env + $arg_noop + {'_catch_errors' => true }
5669
$run_results = run_task(
5770
'puppet_agent::run',
5871
$agent_results.targets,
5972
'Run Puppet agent',
60-
'_catch_errors' => true
73+
$args,
6174
)
6275

6376
# Merge all of the results into a single ResultSet so each

0 commit comments

Comments
 (0)