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 option to prevent a missing env_var var from failing execution #1768

Closed
op-ct opened this issue Apr 25, 2020 · 0 comments · Fixed by #1767
Closed

Add option to prevent a missing env_var var from failing execution #1768

op-ct opened this issue Apr 25, 2020 · 0 comments · Fixed by #1767
Labels
Feature New features and improvements.

Comments

@op-ct
Copy link
Contributor

op-ct commented Apr 25, 2020

Use Case

The env_var plugin is handy, but I don't always need it to stop execution by failing when it isn't set.

Describe the Solution You Would Like

  • A plugin opt to keep the existence of and env_var var optional (and return nil if it does not exist)
  • A plugin opt to provide a default value when the env var var doesn't exist

Describe Alternatives You've Considered

Avoid using env_var at all, and adding system::env() + empty var handling logic to each plan.

@op-ct op-ct added the Feature New features and improvements. label Apr 25, 2020
op-ct added a commit to op-ct/bolt that referenced this issue Apr 25, 2020
Part of puppetlabs#1768

!feature

* Added an `optional` opt to the env_vars plugin

  When `true`, this allows env_var to return `nil` instead of failing
  when the environment variable `var` isn't set.
op-ct added a commit to op-ct/bolt that referenced this issue Apr 25, 2020
Closes puppetlabs#1768

!feature

* Added an `default_value` opt to the env_vars plugin

  The `default_value` opt provides a value to fall back on when the
  environment variable defined by the `var` opt isn't set
@beechtom beechtom linked a pull request Apr 27, 2020 that will close this issue
beechtom added a commit that referenced this issue Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New features and improvements.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant