From a5a78a52bb2345759f5703554e17e08703bca01e Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Thu, 26 May 2011 17:05:28 -0700 Subject: (#7557) Remove Faces Application It used to be that to list the faces available and their actions and options, you had this legacy based face application. This functionality has all been moved into the puppet help face application. Reviewed-by: Daniel Pittman --- lib/puppet/application/faces.rb | 122 ------------------------------------ spec/unit/application/faces_spec.rb | 14 ----- 2 files changed, 136 deletions(-) delete mode 100644 lib/puppet/application/faces.rb delete mode 100755 spec/unit/application/faces_spec.rb diff --git a/lib/puppet/application/faces.rb b/lib/puppet/application/faces.rb deleted file mode 100644 index 3145da821..000000000 --- a/lib/puppet/application/faces.rb +++ /dev/null @@ -1,122 +0,0 @@ -require 'puppet/application' -require 'puppet/face' - -class Puppet::Application::Faces < Puppet::Application - - should_parse_config - run_mode :agent - - option("--debug", "-d") do |arg| - Puppet::Util::Log.level = :debug - end - - option("--verbose", "-v") do - Puppet::Util::Log.level = :info - end - - def help - <<-HELP -puppet-faces(8) -- List available Faces and actions -======== - -SYNOPSIS --------- -Lists the available subcommands (with applicable terminuses and/or actions) -provided by the Puppet Faces API. This information is automatically read -from the Puppet code present on the system. By default, the output includes -all terminuses and actions. - -USAGE ------ -puppet faces [-d|--debug] [-v|--verbose] [actions|terminuses] - -OPTIONS -------- -Note that any configuration option valid in the configuration file is also -a valid long argument. See the configuration file documentation at -http://docs.puppetlabs.com/references/stable/configuration.html for the -full list of acceptable parameters. A commented list of all -configuration options can also be generated by running puppet agent with -'--genconfig'. - -* --verbose: - Sets the log level to "info." This option has no tangible effect at the time - of this writing. - -* --debug: - Sets the log level to "debug." This option has no tangible effect at the time - of this writing. - -AUTHOR ------- -Puppet Labs - -COPYRIGHT ---------- -Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License - - HELP - end - - def list(*arguments) - if arguments.empty? - arguments = %w{terminuses actions} - end - faces.each do |name| - str = "#{name}:\n" - if arguments.include?("terminuses") - begin - terms = Puppet::Indirector::Face.terminus_classes(name.to_sym) - str << "\tTerminuses: #{terms.join(", ")}\n" - rescue => detail - puts detail.backtrace if Puppet[:trace] - $stderr.puts "Could not load terminuses for #{name}: #{detail}" - end - end - - if arguments.include?("actions") - begin - actions = actions(name.to_sym) - str << "\tActions: #{actions.join(", ")}\n" - rescue => detail - puts detail.backtrace if Puppet[:trace] - $stderr.puts "Could not load actions for #{name}: #{detail}" - end - end - - print str - end - end - - attr_accessor :name, :arguments - - def main - list(*arguments) - end - - def setup - Puppet::Util::Log.newdestination :console - - load_applications # Call this to load all of the apps - - @arguments = command_line.args - @arguments ||= [] - end - - def faces - Puppet::Face.faces - end - - def actions(indirection) - return [] unless face = Puppet::Face[indirection, '0.0.1'] - face.load_actions - return face.actions.sort { |a, b| a.to_s <=> b.to_s } - end - - def load_applications - command_line.available_subcommands.each do |app| - command_line.require_application app - end - end -end - diff --git a/spec/unit/application/faces_spec.rb b/spec/unit/application/faces_spec.rb deleted file mode 100755 index cc159b6a5..000000000 --- a/spec/unit/application/faces_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env rspec -require 'spec_helper' -require 'puppet/application/faces' - -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 - subject.expects(:list) - subject.main - end -end -- cgit