[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:12:10 UTC 2011


The following commit has been merged in the experimental branch:
commit 379a3794c4ea3409ba4b1b36dea9a3d35510eb65
Author: Luke Kanies <luke at puppetlabs.com>
Date:   Sat Apr 9 15:05:14 2011 -0700

    Fixing 'puppet faces' application
    
    It only had one available method, and the errors incorrectly
    specified what it was.
    
    This just defaults to listing all the time, and I've updated
    the docs to be correct, too.
    
    Signed-off-by: Luke Kanies <luke at puppetlabs.com>
    Reviewed-by: Daniel Pittman <daniel at puppetlabs.com>

diff --git a/lib/puppet/application/faces.rb b/lib/puppet/application/faces.rb
index 904a0cc..a7b227e 100644
--- a/lib/puppet/application/faces.rb
+++ b/lib/puppet/application/faces.rb
@@ -10,6 +10,12 @@ class Puppet::Application::Faces < Puppet::Application
     Puppet::Util::Log.level = :debug
   end
 
+  option("--help", "-h") do |arg|
+    puts "Usage: puppet faces [actions|terminuses]
+Lists all available interfaces, and by default includes all available terminuses and actions.
+"
+  end
+
   option("--verbose", "-v") do
     Puppet::Util::Log.level = :info
   end
@@ -44,11 +50,10 @@ class Puppet::Application::Faces < Puppet::Application
     end
   end
 
-  attr_accessor :verb, :name, :arguments
+  attr_accessor :name, :arguments
 
   def main
-    # Call the method associated with the provided action (e.g., 'find').
-    send(verb, *arguments)
+    list(*arguments)
   end
 
   def setup
@@ -56,20 +61,8 @@ class Puppet::Application::Faces < Puppet::Application
 
     load_applications # Call this to load all of the apps
 
-    @verb, @arguments = command_line.args
+    @arguments = command_line.args
     @arguments ||= []
-
-    validate
-  end
-
-  def validate
-    unless verb
-      raise "You must specify 'find', 'search', 'save', or 'destroy' as a verb; 'save' probably does not work right now"
-    end
-
-    unless respond_to?(verb)
-      raise "Command '#{verb}' not found for 'faces'"
-    end
   end
 
   def faces
diff --git a/spec/unit/application/faces_spec.rb b/spec/unit/application/faces_spec.rb
index 0b84493..c4d15a2 100755
--- a/spec/unit/application/faces_spec.rb
+++ b/spec/unit/application/faces_spec.rb
@@ -7,4 +7,10 @@ describe Puppet::Application::Faces do
   it "should be an application" do
     Puppet::Application::Faces.superclass.should equal(Puppet::Application)
   end
+
+  it "should always call 'list'" do
+    faces = Puppet::Application::Faces.new
+    faces.expects(:list)
+    faces.main
+  end
 end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list