Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add environment parameter to puppet_runonce task #402

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading