Skip to content

Commit

Permalink
add environment parameter to puppet_runonce task
Browse files Browse the repository at this point in the history
  • Loading branch information
vchepkov committed Nov 20, 2023
1 parent 89602e3 commit 4dbb943
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tasks/puppet_runonce.json
@@ -1,6 +1,10 @@
{
"description": "Run the Puppet agent one time",
"parameters": {
"environment": {
"type": "Optional[String]",
"description": "If set, run Puppet in specified code environment"
},
"noop": {
"type": "Optional[Boolean]",
"description": "If true, run Puppet in no-op mode"
Expand Down
4 changes: 4 additions & 0 deletions tasks/puppet_runonce.sh
Expand Up @@ -6,6 +6,9 @@
# Parse noop parameter
[ "$PT_noop" = "true" ] && NOOP_FLAG="--noop" || unset NOOP_FLAG

# Parse environment parameter
[ -n "$PT_environment" ] && ENV_FLAG="--environment $PT_environment" || unset ENV_FLAG

# Wait for up to five minutes for an in-progress Puppet agent run to complete
# TODO: right now the check is just for lock file existence. Improve the check
# to account for situations where the lockfile is stale.
Expand Down Expand Up @@ -35,6 +38,7 @@ echo
--no-use_cached_catalog \
--detailed-exitcodes \
--color false \
$ENV_FLAG \
$NOOP_FLAG

# Only exit non-zero if an error occurred. Changes (detailed exit code 2) are
Expand Down

0 comments on commit 4dbb943

Please sign in to comment.