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

Puppet Plans are not parsed correctly #128

Closed
genebean opened this issue May 9, 2019 · 5 comments · Fixed by #149
Closed

Puppet Plans are not parsed correctly #128

genebean opened this issue May 9, 2019 · 5 comments · Fixed by #149
Labels
bug Something isn't working

Comments

@genebean
Copy link

genebean commented May 9, 2019

What Versions are you running?

Editor Name and Version: VS Code 1.33.1
Extension: 0.18.0
PDK: 1.10.0 (using embedded Puppet from this)
Puppet: 6.4.0

Document: (Include the whole document)

plan upgrade_pe::enable_lb(
  TargetSpec $load_balancers,
) {
  $_load_balancers = $load_balancers.split(',')
  $cms = run_task('upgrade_pe::enable_lb', $_load_balancers, _catch_errors => true)
  $cms.each |$result| {
    if $result.ok {
      notice("${result.target.name} completed:\n${result.message}")
    } else {
      notice("${result.target.name} errored with message:\n${result.error}")
    }
  }
}

What You Are Seeing?

Lots of red that shouldn't be there

image

What is Expected?

No red when code is correct.

How Did You Get This To Happen? (Steps to Reproduce)

Open any plan with a TargetSpec defined

@jpogran
Copy link
Contributor

jpogran commented May 13, 2019

As discussed in chat, the crux of the issue here is that we rely on the Puppet Plan folder structure conventions (all plans in a top level plans directory) and metadata.json being present (i.e. that this is a module) defined by the Puppet Plans docs to detect we need to enable the Puppet Plans parser. If that is not the case, we don't enable the parser

@genebean
Copy link
Author

Based on above, I think an addition needs to be made for the plans directory being part of a Bolt project as defined at https://puppet.com/docs/bolt/latest/bolt_project_directories.html

The project pictured above corresponds to "Embedded project directory" in the linked docs:

project/ <----------------- this is the folder opened in VS Code
├── Boltdir  <------------- this is the Boltdir in the image above
│   ├── Puppetfile
│   ├── bolt.yaml
│   ├── data
│   │   └── common.yaml
│   ├── inventory.yaml
│   └── site-modules <----- this corresponds to my "site" folder but could have any name
│       └── project <------ this corresponds to my "upgrade_pe" module directory
│           ├── manifests
│           │   └── my_class.pp
│           ├── plans
│           │   ├── deploy.pp
│           │   └── diagnose.pp
│           └── tasks
│               ├── init.json
│               └── init.py
├── src #non Bolt source code for the project
└── tests #non Bolt tests for the project

Note that Bolt projects do not need a metadata.json. I am not sure how you would detect the "Local project directory" version from the docs but the embedded one could key off of the presence of a folder name Boltdir. When that folder is found it could be assumed that any folder named plans with two folders between it and the Boltdir contains Puppet Plans.

@jpogran
Copy link
Contributor

jpogran commented May 13, 2019

FWIW, this was our original source: https://puppet.com/docs/bolt/latest/writing_plans.html#concept-4485. Apparently things have changed

@genebean
Copy link
Author

That does explain a bit :)

@glennsarti glennsarti transferred this issue from puppetlabs/puppet-editor-syntax May 23, 2019
@glennsarti
Copy link
Contributor

Transferred issue to PES as this is not a highlighting issue

@jpogran jpogran added the bug Something isn't working label May 23, 2019
@jpogran jpogran added this to To do in Puppet Bolt Support via automation May 23, 2019
@jpogran jpogran added this to To do in 0.18.1 Marketplace Release via automation May 23, 2019
@jpogran jpogran added this to the 0.20.0 milestone May 23, 2019
@jpogran jpogran removed this from the 0.20.0 milestone May 29, 2019
@jpogran jpogran removed this from To do in 0.18.1 Marketplace Release May 29, 2019
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jun 28, 2019
Previously Puppet Plan files had to exist within a Module however with the
Boltdir being introduced this is no longer true.  This commit updates the
detection to remove the module metadata.json requirement and use the pathname
instead.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jun 28, 2019
Previously the plan detection method was called module_plan_file? however as the
module part is no longer required, the name is now plan_file?.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 1, 2019
Previously Puppet Plan files had to exist within a Module however with the
Boltdir being introduced this is no longer true.  This commit updates the
detection to remove the module metadata.json requirement and use the pathname
instead.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 1, 2019
Previously the plan detection method was called module_plan_file? however as the
module part is no longer required, the name is now plan_file?.
Puppet Bolt Support automation moved this from To do to Done Jul 2, 2019
michaeltlombardi added a commit that referenced this issue Jul 2, 2019
 (GH-128) Detect Puppet Plan files correctly
@jpogran jpogran removed this from Done in Puppet Bolt Support Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants