Issue #7062 has been updated by Daniel Pittman.

Status changed from Unreviewed to Accepted

So, the part about having better error messages would be nice.  The actual 
problem is, er, at least partly an issue with how we define these things: the 
command line basically maps down to a method call, and the method call is not 
really being friendly about responses.

One mooted approach, which also solves some of the issues around HTTP API, is 
to require an option declaration for every parameter to the eventually called 
method, and to allow positional parameters by declaring a set of options to be 
"positional".  That allows us to know, not just infer, the users expected 
behaviour.

At that point we can robustly determine the correct behaviour; short of that we 
actually have a bunch of issues around default values and the like that are 
pretty nasty to deal with. :(
----------------------------------------
Bug #7062: Improve CloudPack option parsing errors
https://projects.puppetlabs.com/issues/7062

Author: Pieter van de Bruggen
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


Consider:

    # --group takes an argument...
    $ puppet node bootstrap --group --keyfile ~/id_pvande.test
    # The current option parsing code issues this warning...
    
/Users/pieter/Projects/puppet-cloudpack/lib/puppet/faces/node/bootstrap.rb:10: 
warning: multiple values for a block parameter (2 for 1)
                from 
/Users/pieter/Projects/puppet/lib/puppet/interface/action.rb+eval:80
    # ...passing these values as the arguments...
    ["/Users/pieter/id_pvande.test", {:login=>"ubuntu", :group=>"--keyfile", 
:image=>"ami-3e02f257", 
:tarball=>"/Users/pieter/Downloads/puppet-enterprise-1.0-all.tar.gz", 
:keypair=>"pvande.test", :answers=>"/Users/pieter/Downloads/puppet.answers"}]
    # ...which causes unexpected errors later.
    
/Users/pieter/Projects/puppet-cloudpack/lib/puppet/faces/node/bootstrap.rb:12:in
 `[]=': Symbol as array index (TypeError)
                from 
/Users/pieter/Projects/puppet-cloudpack/lib/puppet/faces/node/bootstrap.rb:12:in
 `bootstrap implementation, required on Ruby 1.8'
                from 
/Users/pieter/Projects/puppet/lib/puppet/interface/action.rb+eval:80:in 
`__send__'
                from 
/Users/pieter/Projects/puppet/lib/puppet/interface/action.rb+eval:80:in 
`bootstrap'
                from 
/Users/pieter/Projects/puppet/lib/puppet/application/faces_base.rb:145:in `send'
                from 
/Users/pieter/Projects/puppet/lib/puppet/application/faces_base.rb:145:in `main'
                from 
/Users/pieter/Projects/puppet/lib/puppet/application.rb:314:in `run_command'
                from 
/Users/pieter/Projects/puppet/lib/puppet/application.rb:306:in `run'
                from 
/Users/pieter/Projects/puppet/lib/puppet/application.rb:405:in `hook'
                from 
/Users/pieter/Projects/puppet/lib/puppet/application.rb:306:in `run'
                from 
/Users/pieter/Projects/puppet/lib/puppet/application.rb:396:in `exit_on_fail'
                from 
/Users/pieter/Projects/puppet/lib/puppet/application.rb:306:in `run'
                from 
/Users/pieter/Projects/puppet/lib/puppet/util/command_line.rb:62:in `execute'
                from /Users/pieter/Projects/puppet/bin/puppet:4

Such errors should try to be a bit less obtuse.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to