The way the options parser is written, without a custom function either
knife.rb overrides command line options, or command line default values
For the knife vsphere plugin I ended up writing a get_config function to
force command line options > knife.rb > default values in the code.
Not the cleanest approach, but at the time the config hash is being
generated, the knife.rb has not yet been parsed, so it isn’t possible to
set defaults from knife.rb using the built in mixlib.
On Apr 26, 2012 4:47 AM, “AJ Christensen” firstname.lastname@example.org wrote:
I’ve had more than one occasion where it’s impossible to set an option
via the knife.rb, only the CLI. There are a number of issues here. I
have occasionally resorted to medium-Ruby magic to inject my custom,
overridable settings into Knife.
Would definitely like to see both sides of this blade sharpened a little.
On 26 April 2012 20:13, Nick Peirson email@example.com wrote:
Is this the expected behaviour? I’ve raised it as an issue in github
(https://github.com/opscode/knife-ec2/issues/41), but thought I’d seek
others opinions here as well. It seems to prevent knife ec2 commands from
being scripted effectively if there are entries in knife.rb.
Use case is having defaults in knife.rb to spin up instances quickly
testing things without having to type a command line as long as your arm,
but occasionally want a different AMI or to start an instance in a
AZ by quickly overriding on the command line. At the moment it’s a case
having to change the knife.rb, run the command, change it back or,
alternatively, leave the options out of knife.rb and always pass as
It surprises me that this isn’t affecting anyone else, so I’m wondering
I’m doing something to cause this behaviour?