pdk icon indicating copy to clipboard operation
pdk copied to clipboard

pdk bundle does not allow puppet version switching

Open logicminds opened this issue 5 years ago • 5 comments

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

  1. pdk validate --pe-version=2018.1
  2. 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

logicminds avatar Nov 08 '19 16:11 logicminds

This is also https://tickets.puppetlabs.com/browse/PDK-1502

DavidS avatar Nov 11 '19 10:11 DavidS

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

natemccurdy avatar Nov 13 '19 03:11 natemccurdy

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!

scotje avatar Nov 19 '19 01:11 scotje

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?

logicminds avatar Dec 13 '19 16:12 logicminds

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.

github-actions[bot] avatar Aug 26 '21 01:08 github-actions[bot]

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.

github-actions[bot] avatar Aug 21 '22 02:08 github-actions[bot]