infochimps-labs/ironfan — pull request #166 by mrflip (2012-09-23 22:27:22+00:00)
Title: Workaround for bundler swallowing the '--verbose' flag

Recent bundlers swallow the --verbose flag (bundler/issues#2102): 'bundle exec knife ... -VV' never does get the verbositoseness all the way to knife.

I'm preparing a patch for bundler, but being blind to backtraces is horrible enough to justify a workaround:

If you specify '-Z' or '-ZZ' alone as an arg, it will be turned into '-V' or '-VV', resp. Arguments that follow the string 'ssh' are ignored.

```
bundle exec knife cluster show sandbox-mrflip_fiddle-1 --verbose --verbose
# very little output
bundle exec knife cluster show sandbox-mrflip_fiddle-1 -VV
# very little output

bundle exec knife cluster show sandbox-mrflip_fiddle-1 -ZZ
# ... lots and lots of output ...

bundle exec knife cluster -Z ssh awesome-box-0 'awesomehood -Z'
# ... single verbose for knife, and -Z for the awesomehood command
```

I hate monkeying around with ARGV, but a) knife already does so, and b) after some poking around inside knife I don't see a clean way to do this. This only patches up 'knife cluster' commands (things that include Ironfan::KnifeCommon).