diff options
| author | Luke Kanies <luke@puppetlabs.com> | 2011-03-02 17:19:36 -0800 |
|---|---|---|
| committer | Luke Kanies <luke@puppetlabs.com> | 2011-03-02 17:19:36 -0800 |
| commit | 63263a41ab361985845ef514a3d1247a41f46475 (patch) | |
| tree | f9d6eb160e4b05f43ccac67f497dd7a906085838 | |
| parent | 23064bb601622f8a0efaf47c66a9fefec6e62f95 (diff) | |
Fixing #13 - showconfig moved to indirector
I renamed it to 'info', too.
It only showed indirector-related info, so this
makes sense.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| -rw-r--r-- | lib/puppet/interface.rb | 9 | ||||
| -rw-r--r-- | lib/puppet/interface/indirector.rb | 9 | ||||
| -rw-r--r-- | spec/unit/interface/indirector_spec.rb | 20 | ||||
| -rw-r--r-- | spec/unit/interface_spec.rb | 4 |
4 files changed, 21 insertions, 21 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb index 1dfb34cf3..476de8bbf 100644 --- a/lib/puppet/interface.rb +++ b/lib/puppet/interface.rb @@ -82,15 +82,6 @@ class Puppet::Interface attr_accessor :type, :verb, :name, :arguments, :options - # Print the configuration for the current terminus class - action :showconfig do |*args| - if t = indirection.terminus_class - puts "Run mode #{Puppet.run_mode}: #{t}" - else - $stderr.puts "No default terminus class for run mode #{Puppet.run_mode}" - end - end - def initialize(name, options = {}, &block) @name = name diff --git a/lib/puppet/interface/indirector.rb b/lib/puppet/interface/indirector.rb index f106db4b8..9c26cc37a 100644 --- a/lib/puppet/interface/indirector.rb +++ b/lib/puppet/interface/indirector.rb @@ -26,6 +26,15 @@ class Puppet::Interface::Indirector < Puppet::Interface call_indirection_method(:search, *args) end + # Print the configuration for the current terminus class + action :info do |*args| + if t = indirection.terminus_class + puts "Run mode '#{Puppet.run_mode.name}': #{t}" + else + $stderr.puts "No default terminus class for run mode '#{Puppet.run_mode.name}'" + end + end + attr_accessor :from def indirection_name diff --git a/spec/unit/interface/indirector_spec.rb b/spec/unit/interface/indirector_spec.rb index 645c599b3..c0b738c96 100644 --- a/spec/unit/interface/indirector_spec.rb +++ b/spec/unit/interface/indirector_spec.rb @@ -45,15 +45,19 @@ describe Puppet::Interface::Indirector do @instance.indirection.expects(method).with(:test, "myargs") @instance.send(method, :test, "myargs") end + end - it "should be able to override its indirection name" do - @instance.set_indirection_name :foo - @instance.indirection_name.should == :foo - end + it "should be able to override its indirection name" do + @instance.set_indirection_name :foo + @instance.indirection_name.should == :foo + end - it "should be able to set its terminus class" do - @instance.indirection.expects(:terminus_class=).with(:myterm) - @instance.set_terminus(:myterm) - end + it "should be able to set its terminus class" do + @instance.indirection.expects(:terminus_class=).with(:myterm) + @instance.set_terminus(:myterm) + end + + it "should define a class-level 'info' action" do + Puppet::Interface::Indirector.should be_action(:info) end end diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb index 774c0bd91..8799d6b74 100644 --- a/spec/unit/interface_spec.rb +++ b/spec/unit/interface_spec.rb @@ -50,10 +50,6 @@ describe Puppet::Interface do Puppet::Interface.autoloader.should be_instance_of(Puppet::Util::Autoload) end - it "should define a class-level 'showconfig' action" do - Puppet::Interface.should be_action(:showconfig) - end - it "should set any provided options" do Puppet::Interface.new(:me, :verb => "foo").verb.should == "foo" end |
