Skip to content

Commit

Permalink
Merge pull request #402 from vchepkov/runonce_environment
Browse files Browse the repository at this point in the history
add environment parameter to puppet_runonce task
  • Loading branch information
ragingra authored Dec 11, 2023
2 parents 4cd472f + be2870b commit 85ef95f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,12 @@ Run the Puppet agent one time

#### Parameters

##### `environment`

Data type: `Optional[String]`

If set, run Puppet in specified code environment

##### `noop`

Data type: `Optional[Boolean]`
Expand Down
4 changes: 4 additions & 0 deletions tasks/puppet_runonce.json
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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 85ef95f

Please sign in to comment.