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

(bug) Show YAML plan parameters without defaults as required #2095

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

beechtom
Copy link
Contributor

@beechtom beechtom commented Aug 18, 2020

This fixes a minor bug in Bolt::PAL.get_plan_info that incorrectly
built the parameter hash for YAML plans, resulting in an inaccurate
usage line in bolt plan show <plan> output.

Previously, if a YAML plan parameter did not have a default value,
the parameter hash would receive a value of nil for the parameter's
default value. When this hash is received by the outputter to display
the plan info, it would check whether the parameter had a default value
key specified to determine whether it should display the parameter as
optional or required in the usage line. Since parameters for YAML plans
would always have this key, the outputter would show all parameters as
optional. Now, the default value key is only added if there is a default
value for the parameter.

!bug

  • Show YAML plan parameters without default values as required

    Bolt was displaying YAML plan parameters without default values as
    optional in bolt plan show output. Now, Bolt will show a parameter
    without a default value as required.

lib/bolt/pal.rb Outdated Show resolved Hide resolved
@beechtom beechtom force-pushed the bug/yaml-plan-required-params branch from 3bb90c8 to 0743d28 Compare August 18, 2020 22:33
@beechtom beechtom force-pushed the bug/yaml-plan-required-params branch from 0743d28 to bb1c9c4 Compare August 18, 2020 22:56
@puppetcla
Copy link

CLA signed by all contributors.

@nicklewis
Copy link
Contributor

* **Show YAML plan parameters without default values as optional** should be required

This fixes a minor bug in `Bolt::PAL.get_plan_info` that incorrectly
built the parameter hash for YAML plans, resulting in an inaccurate
usage line in `bolt plan show <plan>` output.

Previously, if a YAML plan parameter did not have a default value,
the parameter hash would receive a value of `nil` for the parameter's
default value. When this hash is received by the outputter to display
the plan info, it would check whether the parameter had a default value
key specified to determine whether it should display the parameter as
optional or required in the usage line. Since parameters for YAML plans
would always have this key, the outputter would show all parameters as
optional. Now, the default value key is only added if there is a default
value for the parameter.

!bug

* **Show YAML plan parameters without default values as required**

  Bolt was displaying YAML plan parameters without default values as
  optional in `bolt plan show` output. Now, Bolt will show a parameter
  without a default value as required.
@beechtom beechtom force-pushed the bug/yaml-plan-required-params branch from bb1c9c4 to 9b8aa23 Compare August 19, 2020 16:57
@nicklewis nicklewis merged commit 6774284 into puppetlabs:main Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants