summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application/string_base.rb
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-04 14:46:21 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-04 14:47:06 -0700
commit0950d09d12ec06e97915d264e8724e736c84e36a (patch)
treeded36b42808ab9a214830af0d10a2b365b8f4734 /lib/puppet/application/string_base.rb
parenta2537dc52724386b8f05240e9b18bff437141e79 (diff)
downloadpuppet-0950d09d12ec06e97915d264e8724e736c84e36a.tar.gz
puppet-0950d09d12ec06e97915d264e8724e736c84e36a.tar.xz
puppet-0950d09d12ec06e97915d264e8724e736c84e36a.zip
(#6949) Fix passing positional arguments to actions.
We had a logic failure that didn't pass positional arguments at all, but which our testing didn't verify. This entirely broke things. Now fixed, and a test added to ensure we don't bug out further... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'lib/puppet/application/string_base.rb')
-rw-r--r--lib/puppet/application/string_base.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/puppet/application/string_base.rb b/lib/puppet/application/string_base.rb
index 06e5789be..76b0a46fd 100644
--- a/lib/puppet/application/string_base.rb
+++ b/lib/puppet/application/string_base.rb
@@ -104,16 +104,18 @@ class Puppet::Application::StringBase < Puppet::Application
def setup
Puppet::Util::Log.newdestination :console
- # We copy all of the app options to the end of the call; This allows each
- # action to read in the options. This replaces the older model where we
- # would invoke the action with options set as global state in the
- # interface object. --daniel 2011-03-28
- #
+ @arguments = command_line.args
+
# Note: because of our definition of where the action is set, we end up
# with it *always* being the first word of the remaining set of command
# line arguments. So, strip that off when we construct the arguments to
# pass down to the string action. --daniel 2011-04-04
- @arguments = command_line.args[1, -1] || []
+ @arguments.delete_at(0)
+
+ # We copy all of the app options to the end of the call; This allows each
+ # action to read in the options. This replaces the older model where we
+ # would invoke the action with options set as global state in the
+ # interface object. --daniel 2011-03-28
@arguments << options
end