PDK as a general purpose Puppet validator #1008
Replies: 2 comments
-
Initial thoughts Examples 1 and 2 should be relatively easy-ish to do as validate doesn't require state to be saved in a module directory. Examples 3 is probably easy to do. Even a hacky fix like changing Example 4 looks complicated due to spec fixtures. Also your description says "Running validators" but your code is "test unit" So I'll assume you meant |
Beta Was this translation helpful? Give feedback.
-
Ah good catch, yes I did mean running unit tests for Example 4. I've updated my original comment. For a comparison of the kind of thing we have to do now to get Example 1 working, I've created a Gemfile in my home directory that is a copy of PDK's, and also stubbed out a minimal metadata.json in my home directory.
|
Beta Was this translation helpful? Give feedback.
-
Use Case
It's annoying when I'm helping folks learn Puppet or improve their existing Puppet code that the PDK requires it to be run from within a PDK'ified module. Some times all you want to do is
puppet-lint
a random manifest in your home directory orpuppet parser validate
some old module code that hasn't been converted to the PDK.As it is today, this is impossible to do unless you create a PDK'ified module,
cd
into it, then run yourpdk
commands.The PDK solves the problem of bringing a Ruby environment + Puppet + useful gems onto a system using native packages. I'd very much like to leverage that to be able to run
pdk validate
from anywhere on my system to validate arbitrary Puppet code.I don't want to have re-invent the wheel of installing Ruby+Puppet+Gems seeing as all that is already on my system.
I think this same feature set would make it easy to run pre-commit hooks on a monorepo or validate/unit test code without having to
cd
to that module first.Describe the Solution You Would Like
Example 1: From my home directory, I want to validate Puppet code:
Example 2: From my home directory, I want to run specific linters:
Example 3: Executing unit tests for a module while you're in
~
Example 4: Running unit tests on all sub-directories that are modules
Beta Was this translation helpful? Give feedback.
All reactions