[PDK-408] pdk bundle consumes and rejects option flags meant for bundler subcommands Created: 2017/08/09  Updated: 2017/10/20  Resolved: 2017/10/05

Status: Resolved
Project: Puppet Development Kit
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Charlie Sharpsteen Assignee: David Schmitt
Resolution: Fixed Votes: 0
Labels: known-issue-added, resolved-issue-added
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by PDK-441 Fix argument pass-through on Windows ... Closed
Relates
relates to PDK-406 pdk bundle exec can't find vendored P... Closed
Template:
Epic Link: PDK v1.2.0
Team: Puppet Developer Experience
Method Found: Needs Assessment
Release Notes: Known Issue
Release Notes Summary: This only affects powershell. The problem is that the PDK is consuming command line options meant for the subcommand. The work around is to use 'pdk bundle exec' and then type the command you would like to run with its command line options.

DOCS note: this experimental command is not documented in the docs site, so I've added the known issue in the README, where the command is documented.
QA Risk Assessment: Needs Assessment

 Description   

When run on windows, the pdk bundle command doesn't allow using -- as a separator between pdk option flags and bundler option flags as suggested by pdk help bundle.

Reproduction Case

1. Instal v0.6.0 of the PDK on a Windows 2012 R2 server.
2. Open a Powershell terminal and create a new module using pdk new module.
3. Enter the module directory.
4. Attempt to install gems with binstubs by executing: pdk bundle install – --binstubs

Outcome

The command fails with an "illegal option" error:

PS C:\Users\Administrator\testmod\testbed\testmod> pdk bundle install -- --binstubs
bundle: illegal option -- binstubs

Expected Outcome

Bundler options are accepted and passed to the underlying command. This is the behavior of PDK v0.6.0 on CentOS 7:

[root@xp77oezpmbb65y0 testmod]# pdk bundle install -- --binstubs
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as
root will break this application for all non-root users on this machine.
Using rake 12.0.0
Using fast_gettext 1.1.0
Using json 1.8.1
Using puppet-module-posix-default-r2.1 0.1.0
Using locale 2.1.2
Using text 1.3.1
Using public_suffix 2.0.5
Using spdx-licenses 1.1.0
Using metaclass 0.0.4
Using parallel 1.12.0
Using coderay 1.1.1
Using method_source 0.8.2
Using slop 3.6.0
Using puppet-lint 2.3.0
Using rspec-support 3.6.0
Using diff-lcs 1.3
Using rainbow 2.1.0
Using facter 2.5.0
Using jgrep 1.5.0
Using stomp 1.4.4
Using systemu 2.6.5
Using hiera 3.4.0
Using ast 2.3.0
Using powerpack 0.1.1
Using ruby-progressbar 1.8.1
Using unicode-display_width 1.3.0
Using docile 1.1.5
Using simplecov-html 0.10.1
Using net-ssh 4.1.0
Using net-telnet 0.1.1
Using sfl 2.3
Using bundler 1.15.1
Using puppet-syntax 2.4.1
Using gettext 3.2.3
Using addressable 2.5.1
Using mocha 1.1.0
Using parallel_tests 2.14.2
Using pry 0.10.4
Using rspec-core 3.6.0
Using rspec-expectations 3.6.0
Using rspec-mocks 3.6.0
Using facterdb 0.3.12
Using mcollective-client 2.11.1
Using parser 2.4.0.0
Using simplecov 0.14.1
Using net-scp 1.2.1
Using gettext-setup 0.26
Using json-schema 2.8.0
Using rspec_junit_formatter 0.3.0
Using rspec 3.6.0
Using rubocop 0.49.1
Using specinfra 2.67.3
Using puppet 5.0.1
Using metadata-json-lint 2.0.2
Using rspec-puppet 2.6.7
Using rubocop-rspec 1.15.1
Using rspec-puppet-facts 1.8.0
Using puppetlabs_spec_helper 2.3.1
Using puppet-module-posix-dev-r2.1 0.1.0
Bundle complete! 7 Gemfile dependencies, 59 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
 
[root@xp77oezpmbb65y0 testmod]# ls bin/
bundler   hiera     metadata-json-lint  pry          rmsgfmt            rubocop
catstomp  htmldiff  parallel_cucumber   puppet       rmsginit           ruby-parse
coderay   jgrep     parallel_rspec      puppet-lint  rmsgmerge          ruby-rewrite
facter    ldiff     parallel_spinach    rake         rspec              rxgettext
facterdb  mco       parallel_test       rmsgcat      rspec-puppet-init  stompcat



 Comments   
Comment by Austin Blatt [ 2017/08/11 ]

Example work around

pdk bundle install – --binstubs will install binstubs on non-Windows systems. The equivalent workaround command on Windows Powershell is to do pdk bundle exec "bundle install --binstubs"

Comment by Tim Sharpe [ 2017/08/13 ]

PowerShell seems to handle `--` differently and strips it out of the command arguments, so it never gets sent through to the ruby process.

If you escape the – in PowerShell style with a single backtick, it works as expected.

pdk bundle show `-- --verbose

Generated at Tue Jan 28 07:55:23 PST 2020 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.