pdk
pdk copied to clipboard
pdk bundle does not allow puppet version switching
Describe the bug pdk bundle does not contain the code to switch puppet versions. This causes a situation where if a previous command used a non default version of puppet say 5.5.16, then the pdk bundle command will use the default version (6.10) of puppet. Since this is not desirable behavior as we want to run things with the same ruby version.
To Reproduce
- pdk validate --pe-version=2018.1
- pdk bundle exec puppet-lint -f manifests
Expected behavior It would switch puppet versions
Additional context This bug is due to the binary nature having to skip_option_parsing in the code. We want to parse the CLI but we also want to forward all arguments through bundle exec. However, we cannot do both.
The pdk console command gets around this issue by performing it's own option parsing. The bundle exec command should do the same.
https://github.com/puppetlabs/pdk/blob/master/lib/pdk/cli/console.rb#L94
This is also https://tickets.puppetlabs.com/browse/PDK-1502
I get around this problem by setting the PDK_PUPPET_VERSION
env variable.
e.g.
$ pdk bundle exec puppet --version
pdk (INFO): Using Ruby 2.4.9
pdk (INFO): Using Puppet 5.5.16
5.5.16
$ export PDK_PUPPET_VERSION=6
$ pdk bundle exec puppet --version
pdk (INFO): Using Ruby 2.5.7
pdk (INFO): Using Puppet 6.10.1
6.10.1
This is blocked on a few required changes in our command line library (Cri), and upgrading Cri is blocked on dropping Ruby 2.1.9 support (which will happen soon!). In the meantime, you can workaround this by setting environment variables as @natemccurdy pointed out, but we agree that making the --puppet-version
and --pe-version
flags work as well would be better!
I could just add my parser code (referenced above) to the bundler command and this would unblock for the time being. Is that a reasonable code change?
This issue has been marked stale because it is open with no recent activity. The PDK Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete.
This issue was closed because it is open with no recent activity. The PDK Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete.