-
Notifications
You must be signed in to change notification settings - Fork 21
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
RFC - Better Bolt/Puppet plan detection #129
Comments
Plan Detection Solution 1While naive, this will be effective. "Given the full path to the
Edit 1 : Updated with @genebean 's comments |
For ref, this is how Bolt does it's directory detection https://github.com/puppetlabs/bolt/blob/75a838a99cd24cfe9194a97923f162781685a4ae/lib/bolt/boltdir.rb#L5-L51 |
Will that cause problems in a scenario where I have something like Maybe there should be a conditional added to the "if path includes /plans" so that its actually "if path includes /plans and /plans is not a subfolder of /manifests" |
Yup - thus the
👍 |
Closing and going with "Given the full path to the
|
Problem
Bolt/Puppet plan files (
*.pp
manifest files) are raising linting/parsing errors. This is due to Pupet Editor Services (PES) not detecting it is a plan file and then not setting the Puppet parser into "tasks" mode.Note that we can't force all puppet manifests into "tasks" mode as there are things you can't do in plans but you can in normal manifests and vice versa.
This RFC will describe how PES can reliably detect whether manifests are a plan or not.
Current Detection
The current detection is based on the documenation at https://puppet.com/docs/bolt/latest/writing_plans.html#concept-4485
/plans
directorymetadata.json
fileThis is codified at https://github.com/lingua-pupuli/puppet-editor-services/blob/78bb4b108ed70b72ae48c08b56232579af36b92b/lib/puppet-languageserver/document_store.rb#L57-L64
Why the current detection fails
Bolt has introduced the concept of a Bolt project dir (or Boltdir) and this has caused issues like #127 and #128
https://puppet.com/docs/bolt/latest/bolt_project_directories.html
So now there are two aditional scenarios where plans can be located:
Note that in neither of these directory trees are a metadata.json or environment.conf so PES thinks that these
.pp
files are "standalone" and there is no workspace metadata information, therefore the linting is never put into "tasks" mode.Local project directory
Embedded project directory
Also note that plans can exist in subdirectories, for example
project/Boltdir/site-modules/project/plans/foo/bar/wizz/diagnose.pp
is a plan calledproject::foo::bar::wiz::diagnose
The text was updated successfully, but these errors were encountered: