-
Notifications
You must be signed in to change notification settings - Fork 104
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
Add new "pdk console" command #758
Conversation
@logicminds I assume this relates to puppetlabs-toy-chest/pdk-planning#44 May need to update the RFC with the new name of |
@@ -105,6 +105,20 @@ This command runs all available unit tests. | |||
|
|||
## Experimental features | |||
|
|||
### `pdk console` command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbondpdx Can you give these docs a quick look.
-
To use just execute
avoidjust
andeasy
-
~/modules/ntp $ ...
Avoid shell specific things e.g. a PowerShell user would see this prefixed differently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the README with the fixes and also added some extra bits I thought were important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't see this sooner, @glennsarti , @logicminds ... I think it got lost in a mass of GitHub emails. Thank you for both for these docs!
Added another commit that helps the user if the puppet-debugger gem is missing.
|
82932e4
to
68d9167
Compare
@rodjek @glennsarti I spent some time refactoring my tests and they no longer run the debugger and instead just validate the args being passed through to the debugger. We know the debugger works so there is no need to test it's functionality. Not running the debugger speeds up the tests greatly and removes the need for the dependency as well. This strategy might be something we can do with other pdk commands as well. Anyways, this is ready to go. |
75a8f7b
to
5d34bfc
Compare
Hrmm the
Removing that setting I get a pdk console prompt
Makes sense as the environment layout is different to a modulepath |
This commit updates the console command to lazy load the required libraries.
Previously when using the PDK as a gem, the lockfile used to detect the debugger would use the PDK's lock file, not the module context. This commit changes the lock file location to be that of the module.
Previously the debugger reset the environment path to that of the modulepath however, on a configured Puppet Agent this is incorrect. The puppet-debugger should really use the default environment path.
I don't have rights on your branch but here are my changes - |
@glennsarti added your changes and updated my tests. I also added a new check to ensure the user has fixtures downloaded. Currently this is just a warning message as it only impacts the modules the debugger has access too.
|
* Add a new command called console that is a pass through to the puppet debugger console. * Only allows for use within a module at this time.
* previously if the user was not inside the module and had a lib folder present the console command would dump a stack trace. This fixes that by also performing a deep inspection of the module first.
🎉🎉🎉🎉 |
Adds a new command called
console
that invokes the puppet debugger console from within a module. This command respects the puppet-version, puppet-dev, and pe-version options but has to parse them manually due to how CRI works and becoming a broker to the puppet debugger command. Otherwise thepdk console
command works just like the puppet debugger command and can be passed the same exact options. In fact usingpdk console -h
will actually return the help info from the puppet debugger command. This is the reason why I had to skip option parsing.At the moment this only works inside a module due to some limitations of the PDK and external gems. However, working inside a module allows for a scoped invocation of the puppet debugger scoped for the module. This allows for users to easily test out their module code, facts, datatypes and more without having to supply the modulepath.
This also relies on the user having the puppet-debugger gem in their Gemfile. The following PR should ensure the user has this already. Otherwise the user would need to add puppet-debugger to the .sync.yml file. If the user does not have the puppet-debugger gem they will get the following error. Once solution to work around this is to figure out if they have the gem present already, but this procedure slows down the console command and was removed from the PR.
This PR also relies on #753 and #755 and I have included them as separate PRs and also in this branch.
The demo below shows several invocations with different puppet versions which is quite handy. The delay you may notice is
PDK::Util::Bundler.ensure_bundle!(puppet_env[:gemset])
being run to ensure the correct puppet version is installed.