Issue #5840 has been updated by Daniel Pittman.

> This seems weird. Shouldn’t anything that starts with a dash be an option,
> regardless of whether you want to use ‘apply’? That is, are we supporting
> filenames that start with a dash or something?

It totally *is* an option.  The interpretation of the example is:

] puppet --trace data foo bar
1. First thing on the command line starts with '-', load the 'apply'
application.
2. Parse the options for the apply application, leaving 'data foo bar'
on the command line.
2A. the `apply` application sets the trace option, as it should.
3. Try to apply the file `data`.
4. Correctly report that `data` does not exist.

So, it will be treated as an option, but it is also pre-interpreted to
mean "an option to the apply application" by the loader.

This was introduced when the unified invocation stuff was done, since
previously 'puppet --trace data' would indeed have been equivalent to
'puppet apply --trace data' now.  It is arguable the correct
interpretation of what a user used to the pre-unification CLI would
have expected.
----------------------------------------
Bug #5840: Util/command_line treats options as applications
https://projects.puppetlabs.com/issues/5840

Author: Luke Kanies
Status: Accepted
Priority: Normal
Assignee: Daniel Pittman
Category: Faces
Target version: Telly
Affected Puppet version: 2.6.0
Keywords: 
Branch: 


Given this command line with a custom application:
<pre>
$ puppet --trace data certificate find foo
</pre>
You get an exception from the 'apply' application, rather than the 'data' 
application:
<pre>
luke@syringe $ puppet --trace data certificate find syringe
/Users/luke/puppet/lib/puppet/application/apply.rb:82:in `main'
/Users/luke/puppet/lib/puppet/application/apply.rb:35:in `run_command'
/Users/luke/puppet/lib/puppet/application.rb:287:in `run'
/Users/luke/puppet/lib/puppet/application.rb:393:in `exit_on_fail'
/Users/luke/puppet/lib/puppet/application.rb:287:in `run'
/Users/luke/puppet/lib/puppet/util/command_line.rb:59:in `execute'
/Users/luke/puppet/bin/puppet:4
Could not run: Could not find file data
luke@syringe $
</pre>
If you move the '--trace' to after 'data', then it works fine.

This should either work (which seems the best choice) or fail with a useful 
error message, rather than loading the wrong application entirely.


-- 
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