summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-07 14:20:35 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-07 15:52:04 -0700
commit8d144d0bf5116c5f04522f2b4cd75699f6480f8e (patch)
treed1f0a58fc106b04c9149782b56b0736394ef931b /lib/puppet/application
parent5592034fdb8bf3a72ab3133d69443490f9ad7b78 (diff)
downloadpuppet-8d144d0bf5116c5f04522f2b4cd75699f6480f8e.tar.gz
puppet-8d144d0bf5116c5f04522f2b4cd75699f6480f8e.tar.xz
puppet-8d144d0bf5116c5f04522f2b4cd75699f6480f8e.zip
(#7012) Update references in code to use face(s)
The codebase is now using the new name, faces, uniformly to reference the objects contained. All tests pass.
Diffstat (limited to 'lib/puppet/application')
-rw-r--r--lib/puppet/application/config.rb4
-rw-r--r--lib/puppet/application/configurer.rb6
-rw-r--r--lib/puppet/application/faces.rb18
-rw-r--r--lib/puppet/application/faces_base.rb24
-rw-r--r--lib/puppet/application/indirection_base.rb4
5 files changed, 28 insertions, 28 deletions
diff --git a/lib/puppet/application/config.rb b/lib/puppet/application/config.rb
index f6559277b..41a46c339 100644
--- a/lib/puppet/application/config.rb
+++ b/lib/puppet/application/config.rb
@@ -1,4 +1,4 @@
-require 'puppet/application/string_base'
+require 'puppet/application/faces_base'
-class Puppet::Application::Config < Puppet::Application::StringBase
+class Puppet::Application::Config < Puppet::Application::FacesBase
end
diff --git a/lib/puppet/application/configurer.rb b/lib/puppet/application/configurer.rb
index be018338f..751e6b4d7 100644
--- a/lib/puppet/application/configurer.rb
+++ b/lib/puppet/application/configurer.rb
@@ -1,5 +1,5 @@
require 'puppet/application'
-require 'puppet/string'
+require 'puppet/faces'
class Puppet::Application::Configurer < Puppet::Application
should_parse_config
@@ -17,7 +17,7 @@ class Puppet::Application::Configurer < Puppet::Application
end
def run_command
- report = Puppet::String[:configurer, '0.0.1'].synchronize(Puppet[:certname])
- Puppet::String[:report, '0.0.1'].submit(report)
+ report = Puppet::Faces[:configurer, '0.0.1'].synchronize(Puppet[:certname])
+ Puppet::Faces[:report, '0.0.1'].submit(report)
end
end
diff --git a/lib/puppet/application/faces.rb b/lib/puppet/application/faces.rb
index 0a6a798ce..904a0cccc 100644
--- a/lib/puppet/application/faces.rb
+++ b/lib/puppet/application/faces.rb
@@ -1,7 +1,7 @@
require 'puppet/application'
-require 'puppet/string'
+require 'puppet/faces'
-class Puppet::Application::String < Puppet::Application
+class Puppet::Application::Faces < Puppet::Application
should_parse_config
run_mode :agent
@@ -18,7 +18,7 @@ class Puppet::Application::String < Puppet::Application
if arguments.empty?
arguments = %w{terminuses actions}
end
- strings.each do |name|
+ faces.each do |name|
str = "#{name}:\n"
if arguments.include?("terminuses")
begin
@@ -68,12 +68,12 @@ class Puppet::Application::String < Puppet::Application
end
unless respond_to?(verb)
- raise "Command '#{verb}' not found for 'string'"
+ raise "Command '#{verb}' not found for 'faces'"
end
end
- def strings
- Puppet::String.strings
+ def faces
+ Puppet::Faces.faces
end
def terminus_classes(indirection)
@@ -81,9 +81,9 @@ class Puppet::Application::String < Puppet::Application
end
def actions(indirection)
- return [] unless string = Puppet::String[indirection, '0.0.1']
- string.load_actions
- return string.actions.sort { |a, b| a.to_s <=> b.to_s }
+ return [] unless faces = Puppet::Faces[indirection, '0.0.1']
+ faces.load_actions
+ return faces.actions.sort { |a, b| a.to_s <=> b.to_s }
end
def load_applications
diff --git a/lib/puppet/application/faces_base.rb b/lib/puppet/application/faces_base.rb
index 09d02c079..6d66ee8a1 100644
--- a/lib/puppet/application/faces_base.rb
+++ b/lib/puppet/application/faces_base.rb
@@ -1,7 +1,7 @@
require 'puppet/application'
-require 'puppet/string'
+require 'puppet/faces'
-class Puppet::Application::StringBase < Puppet::Application
+class Puppet::Application::FacesBase < Puppet::Application
should_parse_config
run_mode :agent
@@ -24,7 +24,7 @@ class Puppet::Application::StringBase < Puppet::Application
end
- attr_accessor :string, :action, :type, :arguments, :format
+ attr_accessor :face, :action, :type, :arguments, :format
attr_writer :exit_code
# This allows you to set the exit code if you don't want to just exit
@@ -47,7 +47,7 @@ class Puppet::Application::StringBase < Puppet::Application
def preinit
super
trap(:INT) do
- $stderr.puts "Cancelling String"
+ $stderr.puts "Cancelling Face"
exit(0)
end
@@ -57,8 +57,8 @@ class Puppet::Application::StringBase < Puppet::Application
# TODO: These should be configurable versions, through a global
# '--version' option, but we don't implement that yet... --daniel 2011-03-29
@type = self.class.name.to_s.sub(/.+:/, '').downcase.to_sym
- @string = Puppet::String[@type, :current]
- @format = @string.default_format
+ @face = Puppet::Faces[@type, :current]
+ @format = @face.default_format
# Now, walk the command line and identify the action. We skip over
# arguments based on introspecting the action and all, and find the first
@@ -68,11 +68,11 @@ class Puppet::Application::StringBase < Puppet::Application
until @action or (index += 1) >= command_line.args.length do
item = command_line.args[index]
if item =~ /^-/ then
- option = @string.options.find do |name|
+ option = @face.options.find do |name|
item =~ /^-+#{name.to_s.gsub(/[-_]/, '[-_]')}(?:[ =].*)?$/
end
if option then
- option = @string.get_option(option)
+ option = @face.get_option(option)
# If we have an inline argument, just carry on. We don't need to
# care about optional vs mandatory in that case because we do a real
# parse later, and that will totally take care of raising the error
@@ -91,9 +91,9 @@ class Puppet::Application::StringBase < Puppet::Application
raise ArgumentError, "Unknown option #{item.sub(/=.*$/, '').inspect}"
end
else
- action = @string.get_action(item.to_sym)
+ action = @face.get_action(item.to_sym)
if action.nil? then
- raise ArgumentError, "#{@string} does not have an #{item.inspect} action!"
+ raise ArgumentError, "#{@face} does not have an #{item.inspect} action!"
end
@action = action
end
@@ -129,7 +129,7 @@ class Puppet::Application::StringBase < Puppet::Application
# 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
+ # pass down to the face action. --daniel 2011-04-04
@arguments.delete_at(0)
# We copy all of the app options to the end of the call; This allows each
@@ -142,7 +142,7 @@ class Puppet::Application::StringBase < Puppet::Application
def main
# Call the method associated with the provided action (e.g., 'find').
- if result = @string.send(@action.name, *arguments)
+ if result = @face.send(@action.name, *arguments)
puts render(result)
end
exit(exit_code)
diff --git a/lib/puppet/application/indirection_base.rb b/lib/puppet/application/indirection_base.rb
index cfa1ea529..7455ebedf 100644
--- a/lib/puppet/application/indirection_base.rb
+++ b/lib/puppet/application/indirection_base.rb
@@ -1,4 +1,4 @@
-require 'puppet/application/string_base'
+require 'puppet/application/faces_base'
-class Puppet::Application::IndirectionBase < Puppet::Application::StringBase
+class Puppet::Application::IndirectionBase < Puppet::Application::FacesBase
end