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

Run 'plan convert' with plan name #2712

Merged
merged 1 commit into from
Mar 15, 2021

Conversation

beechtom
Copy link
Contributor

This adds support for calling bolt plan convert and Convert-BoltPlan
with the name of a plan instead of just the path to a plan.

!feature

  • Convert YAML plans by name

    The bolt plan convert and Convert-BoltPlan commands now accept the
    name of a YAML plan to convert instead of just a path to a YAML plan.

@beechtom beechtom requested a review from a team as a code owner March 15, 2021 16:48
lib/bolt/pal.rb Outdated Show resolved Hide resolved
This adds support for calling `bolt plan convert` and `Convert-BoltPlan`
with the name of a plan instead of just the path to a plan.

!feature

* **Convert YAML plans by name**

  The `bolt plan convert` and `Convert-BoltPlan` commands now accept the
  name of a YAML plan to convert instead of just a path to a YAML plan.
# If the plan was loaded, look for it on the module loader
# There has to be an easier way to do this...
if sig
type = compiler.list_plans.find { |p| p.name == plan }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I spent some time looking to see if there's a better way, but I think that might have diminishing returns - ultimately I don't think it's going to be a whole lot more efficient or readable than this :/

Copy link
Contributor

@nicklewis nicklewis Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can do something like

typed_name = Puppet::Pops::Parser::TypedName.new(:plan, plan)
Puppet.lookup(:loaders).private_environment_loader.find(typed_name)

@lucywyman lucywyman merged commit b3b99d4 into puppetlabs:main Mar 15, 2021
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