[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Luke Kanies
luke at puppetlabs.com
Tue May 10 08:05:20 UTC 2011
The following commit has been merged in the experimental branch:
commit 21b541d6ca4b1b76a4e0cd525fa66192c0857a5e
Author: Luke Kanies <luke at puppetlabs.com>
Date: Thu Feb 24 08:34:24 2011 -0800
Fixing plugin usage
I had broken some usages of plugins by incorrectly
selecting command-line arguments. The fix was
to remove the #main method contained in the
IndirectionBase subclass.
Signed-off-by: Luke Kanies <luke at puppetlabs.com>
diff --git a/lib/puppet/application/indirection_base.rb b/lib/puppet/application/indirection_base.rb
index 3e90769..e6d172c 100644
--- a/lib/puppet/application/indirection_base.rb
+++ b/lib/puppet/application/indirection_base.rb
@@ -8,13 +8,6 @@ class Puppet::Application::IndirectionBase < Puppet::Application::InterfaceBase
attr_accessor :from, :indirection
- def main
- # Call the method associated with the provided action (e.g., 'find').
- result = interface.send(verb, name, *arguments)
- render_method = Puppet::Network::FormatHandler.format(format).render_method
- puts result.send(render_method) if result
- end
-
def setup
super
diff --git a/lib/puppet/application/interface_base.rb b/lib/puppet/application/interface_base.rb
index 044249d..70022f1 100644
--- a/lib/puppet/application/interface_base.rb
+++ b/lib/puppet/application/interface_base.rb
@@ -61,6 +61,8 @@ class Puppet::Application::InterfaceBase < Puppet::Application
@verb, @arguments = command_line.args
@arguments ||= []
+ @arguments = Array(@arguments)
+
@type = self.class.name.to_s.sub(/.+:/, '').downcase.to_sym
unless @interface = Puppet::Interface.interface(@type)
diff --git a/spec/unit/application/interface_base_spec.rb b/spec/unit/application/interface_base_spec.rb
index 4ef3869..1717f49 100644
--- a/spec/unit/application/interface_base_spec.rb
+++ b/spec/unit/application/interface_base_spec.rb
@@ -14,6 +14,7 @@ describe Puppet::Application::InterfaceBase do
@app.stubs(:interface).returns base_interface
@app.stubs(:exit)
@app.stubs(:puts)
+ Puppet::Util::Log.stubs(:newdestination)
end
describe "when calling main" do
@@ -40,6 +41,17 @@ describe Puppet::Application::InterfaceBase do
@app.stubs(:validate)
end
+ it "should set the verb from the command line arguments" do
+ @app.setup
+ @app.verb.should == "find"
+ end
+
+ it "should make sure arguments are an array" do
+ @app.command_line.stubs(:args).returns(["find", "myname"])
+ @app.setup
+ @app.arguments.should == ["myname"]
+ end
+
it "should set the options on the interface" do
@app.options[:foo] = "bar"
@app.setup
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list