From dd8108cd8f48d399ab728c3437e3fef38f0eb46c Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 31 May 2011 15:05:54 -0700 Subject: #7211: nasty logic error with global Face options taking arguments. A logic error meant that global Face options that took arguments were mishandled: we never consumed the argument, so we read this: puppet facts --render-as json find $(hostname) ...as meaning "invoke the 'json' action on the 'facts' face"... This fixes that problem, so we now correctly handle both optional and non-optional arguments to global Face options. --- lib/puppet/application/face_base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/application/face_base.rb b/lib/puppet/application/face_base.rb index 2f07faae1..ea5ba4aaf 100644 --- a/lib/puppet/application/face_base.rb +++ b/lib/puppet/application/face_base.rb @@ -91,7 +91,7 @@ class Puppet::Application::FaceBase < Puppet::Application index += 1 # ...so skip the argument. end elsif option = find_application_argument(item) then - index += 1 if (option[:argument] and option[:optional]) + index += 1 if (option[:argument] and not option[:optional]) else raise OptionParser::InvalidOption.new(item.sub(/=.*$/, '')) end -- cgit