diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-13 00:38:53 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-13 00:38:53 -0700 |
| commit | b060ca7e1594a6ecfd6b1e32933e6a531b08bcf4 (patch) | |
| tree | 95c35f65addba0d408cb7f5c9e2c5de53724a737 /lib | |
| parent | 941c56a283265cdf5a951ecaae63580b60486c52 (diff) | |
| parent | db11770718c61f9ee3d5fcd703c5c0c7c05227ca (diff) | |
| download | puppet-b060ca7e1594a6ecfd6b1e32933e6a531b08bcf4.tar.gz puppet-b060ca7e1594a6ecfd6b1e32933e6a531b08bcf4.tar.xz puppet-b060ca7e1594a6ecfd6b1e32933e6a531b08bcf4.zip | |
Merge branch 'bug/next/7056-use-face-rather-than-faces' into next
Diffstat (limited to 'lib')
40 files changed, 96 insertions, 96 deletions
diff --git a/lib/puppet/application/config.rb b/lib/puppet/application/config.rb index 41a46c339..a94441e7f 100644 --- a/lib/puppet/application/config.rb +++ b/lib/puppet/application/config.rb @@ -1,4 +1,4 @@ -require 'puppet/application/faces_base' +require 'puppet/application/face_base' -class Puppet::Application::Config < Puppet::Application::FacesBase +class Puppet::Application::Config < Puppet::Application::FaceBase end diff --git a/lib/puppet/application/configurer.rb b/lib/puppet/application/configurer.rb index 751e6b4d7..6e86cd2d4 100644 --- a/lib/puppet/application/configurer.rb +++ b/lib/puppet/application/configurer.rb @@ -1,5 +1,5 @@ require 'puppet/application' -require 'puppet/faces' +require 'puppet/face' 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::Faces[:configurer, '0.0.1'].synchronize(Puppet[:certname]) - Puppet::Faces[:report, '0.0.1'].submit(report) + report = Puppet::Face[:configurer, '0.0.1'].synchronize(Puppet[:certname]) + Puppet::Face[:report, '0.0.1'].submit(report) end end diff --git a/lib/puppet/application/faces_base.rb b/lib/puppet/application/face_base.rb index f1b77f285..2a048a532 100644 --- a/lib/puppet/application/faces_base.rb +++ b/lib/puppet/application/face_base.rb @@ -1,8 +1,8 @@ require 'puppet/application' -require 'puppet/faces' +require 'puppet/face' require 'optparse' -class Puppet::Application::FacesBase < Puppet::Application +class Puppet::Application::FaceBase < Puppet::Application should_parse_config run_mode :agent @@ -60,7 +60,7 @@ class Puppet::Application::FacesBase < Puppet::Application # REVISIT: 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 - @face = Puppet::Faces[@type, :current] + @face = Puppet::Face[@type, :current] @format = @face.default_format # Now, walk the command line and identify the action. We skip over diff --git a/lib/puppet/application/faces.rb b/lib/puppet/application/faces.rb index a7b227e23..3dd3f0312 100644 --- a/lib/puppet/application/faces.rb +++ b/lib/puppet/application/faces.rb @@ -1,5 +1,5 @@ require 'puppet/application' -require 'puppet/faces' +require 'puppet/face' class Puppet::Application::Faces < Puppet::Application @@ -12,7 +12,7 @@ class Puppet::Application::Faces < Puppet::Application option("--help", "-h") do |arg| puts "Usage: puppet faces [actions|terminuses] -Lists all available interfaces, and by default includes all available terminuses and actions. +Lists all available faces, and by default includes all available terminuses and actions. " end @@ -66,7 +66,7 @@ Lists all available interfaces, and by default includes all available terminuses end def faces - Puppet::Faces.faces + Puppet::Face.faces end def terminus_classes(indirection) @@ -74,9 +74,9 @@ Lists all available interfaces, and by default includes all available terminuses end def actions(indirection) - return [] unless faces = Puppet::Faces[indirection, '0.0.1'] - faces.load_actions - return faces.actions.sort { |a, b| a.to_s <=> b.to_s } + 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 diff --git a/lib/puppet/application/help.rb b/lib/puppet/application/help.rb index fd8818db0..0d7767632 100644 --- a/lib/puppet/application/help.rb +++ b/lib/puppet/application/help.rb @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -require 'puppet/application/faces_base' +require 'puppet/application/face_base' -class Puppet::Application::Help < Puppet::Application::FacesBase +class Puppet::Application::Help < Puppet::Application::FaceBase # Meh. Disable the default behaviour, which is to inspect the # string and return that – not so helpful. --daniel 2011-04-11 def render(result) result end diff --git a/lib/puppet/application/indirection_base.rb b/lib/puppet/application/indirection_base.rb index 7455ebedf..580a0999a 100644 --- a/lib/puppet/application/indirection_base.rb +++ b/lib/puppet/application/indirection_base.rb @@ -1,4 +1,4 @@ -require 'puppet/application/faces_base' +require 'puppet/application/face_base' -class Puppet::Application::IndirectionBase < Puppet::Application::FacesBase +class Puppet::Application::IndirectionBase < Puppet::Application::FaceBase end diff --git a/lib/puppet/faces.rb b/lib/puppet/face.rb index 947eecf24..f73b2fc3b 100644 --- a/lib/puppet/faces.rb +++ b/lib/puppet/face.rb @@ -1,4 +1,4 @@ -# The public name of this feature is 'faces', but we have hidden all the +# The public name of this feature is 'face', but we have hidden all the # plumbing over in the 'interfaces' namespace to make clear the distinction # between the two. # @@ -9,4 +9,4 @@ # It isn't hidden to gratuitously hide things, just to make it easier to # separate out the interests people will have. --daniel 2011-04-07 require 'puppet/interface' -Puppet::Faces = Puppet::Interface +Puppet::Face = Puppet::Interface diff --git a/lib/puppet/faces/catalog.rb b/lib/puppet/face/catalog.rb index 3353d5d04..0dcde3591 100644 --- a/lib/puppet/faces/catalog.rb +++ b/lib/puppet/face/catalog.rb @@ -1,6 +1,6 @@ -require 'puppet/faces/indirector' +require 'puppet/face/indirector' -Puppet::Faces::Indirector.define(:catalog, '0.0.1') do +Puppet::Face::Indirector.define(:catalog, '0.0.1') do action(:apply) do when_invoked do |catalog, options| report = Puppet::Transaction::Report.new("apply") @@ -28,7 +28,7 @@ Puppet::Faces::Indirector.define(:catalog, '0.0.1') do facts_to_upload = {:facts_format => :b64_zlib_yaml, :facts => CGI.escape(facts.render(:b64_zlib_yaml))} catalog = nil retrieval_duration = thinmark do - catalog = Puppet::Faces[:catalog, '0.0.1'].find(certname, facts_to_upload) + catalog = Puppet::Face[:catalog, '0.0.1'].find(certname, facts_to_upload) end catalog = catalog.to_ral catalog.finalize diff --git a/lib/puppet/faces/catalog/select.rb b/lib/puppet/face/catalog/select.rb index e29d19970..ba27117bc 100644 --- a/lib/puppet/faces/catalog/select.rb +++ b/lib/puppet/face/catalog/select.rb @@ -1,5 +1,5 @@ # Select and show a list of resources of a given type. -Puppet::Faces.define(:catalog, '0.0.1') do +Puppet::Face.define(:catalog, '0.0.1') do action :select do when_invoked do |host, type, options| catalog = Puppet::Resource::Catalog.indirection.find(host) diff --git a/lib/puppet/faces/certificate.rb b/lib/puppet/face/certificate.rb index b10bee579..77e80f099 100644 --- a/lib/puppet/faces/certificate.rb +++ b/lib/puppet/face/certificate.rb @@ -1,7 +1,7 @@ -require 'puppet/faces/indirector' +require 'puppet/face/indirector' require 'puppet/ssl/host' -Puppet::Faces::Indirector.define(:certificate, '0.0.1') do +Puppet::Face::Indirector.define(:certificate, '0.0.1') do # REVISIT: This should use a pre-invoke hook to run the common code that # needs to happen before we invoke any action; that would be much nicer than # the "please repeat yourself" stuff found in here right now. diff --git a/lib/puppet/face/certificate_request.rb b/lib/puppet/face/certificate_request.rb new file mode 100644 index 000000000..1feba25ab --- /dev/null +++ b/lib/puppet/face/certificate_request.rb @@ -0,0 +1,4 @@ +require 'puppet/face/indirector' + +Puppet::Face::Indirector.define(:certificate_request, '0.0.1') do +end diff --git a/lib/puppet/face/certificate_revocation_list.rb b/lib/puppet/face/certificate_revocation_list.rb new file mode 100644 index 000000000..6a75aa578 --- /dev/null +++ b/lib/puppet/face/certificate_revocation_list.rb @@ -0,0 +1,4 @@ +require 'puppet/face/indirector' + +Puppet::Face::Indirector.define(:certificate_revocation_list, '0.0.1') do +end diff --git a/lib/puppet/faces/config.rb b/lib/puppet/face/config.rb index 647bf5052..45cb6b156 100644 --- a/lib/puppet/faces/config.rb +++ b/lib/puppet/face/config.rb @@ -1,6 +1,6 @@ -require 'puppet/faces' +require 'puppet/face' -Puppet::Faces.define(:config, '0.0.1') do +Puppet::Face.define(:config, '0.0.1') do action(:print) do when_invoked do |*args| options = args.pop diff --git a/lib/puppet/face/configurer.rb b/lib/puppet/face/configurer.rb new file mode 100644 index 000000000..74dfb854e --- /dev/null +++ b/lib/puppet/face/configurer.rb @@ -0,0 +1,12 @@ +require 'puppet/face' + +Puppet::Face.define(:configurer, '0.0.1') do + action(:synchronize) do + when_invoked do |certname, options| + facts = Puppet::Face[:facts, '0.0.1'].find(certname) + catalog = Puppet::Face[:catalog, '0.0.1'].download(certname, facts) + report = Puppet::Face[:catalog, '0.0.1'].apply(catalog) + report + end + end +end diff --git a/lib/puppet/faces/facts.rb b/lib/puppet/face/facts.rb index 33eacef38..8668b2531 100644 --- a/lib/puppet/faces/facts.rb +++ b/lib/puppet/face/facts.rb @@ -1,7 +1,7 @@ -require 'puppet/faces/indirector' +require 'puppet/face/indirector' require 'puppet/node/facts' -Puppet::Faces::Indirector.define(:facts, '0.0.1') do +Puppet::Face::Indirector.define(:facts, '0.0.1') do set_default_format :yaml # Upload our facts to the server diff --git a/lib/puppet/face/file.rb b/lib/puppet/face/file.rb new file mode 100644 index 000000000..1aa9462dd --- /dev/null +++ b/lib/puppet/face/file.rb @@ -0,0 +1,5 @@ +require 'puppet/face/indirector' + +Puppet::Face::Indirector.define(:file, '0.0.1') do + set_indirection_name :file_bucket_file +end diff --git a/lib/puppet/faces/help.rb b/lib/puppet/face/help.rb index 1d8abe20e..1c2da9e83 100644 --- a/lib/puppet/faces/help.rb +++ b/lib/puppet/face/help.rb @@ -1,9 +1,9 @@ -require 'puppet/faces' +require 'puppet/face' require 'puppet/util/command_line' require 'pathname' require 'erb' -Puppet::Faces.define(:help, '0.0.1') do +Puppet::Face.define(:help, '0.0.1') do summary "Displays help about puppet subcommands" action(:help) do @@ -41,7 +41,7 @@ Puppet::Faces.define(:help, '0.0.1') do actionname and raise ArgumentError, "Legacy subcommands don't take actions" return Puppet::Application[facename].help else - face = Puppet::Faces[facename.to_sym, version] + face = Puppet::Face[facename.to_sym, version] actionname and action = face.get_action(actionname.to_sym) end end @@ -76,9 +76,9 @@ Puppet::Faces.define(:help, '0.0.1') do def legacy_applications # The list of applications, less those that are duplicated as a face. Puppet::Util::CommandLine.available_subcommands.reject do |appname| - Puppet::Faces.face? appname.to_sym, :current or + Puppet::Face.face? appname.to_sym, :current or # ...this is a nasty way to exclude non-applications. :( - %w{faces_base indirection_base}.include? appname + %w{face_base indirection_base}.include? appname end.sort end diff --git a/lib/puppet/faces/help/action.erb b/lib/puppet/face/help/action.erb index eaf131464..eaf131464 100644 --- a/lib/puppet/faces/help/action.erb +++ b/lib/puppet/face/help/action.erb diff --git a/lib/puppet/faces/help/face.erb b/lib/puppet/face/help/face.erb index efe5fd809..efe5fd809 100644 --- a/lib/puppet/faces/help/face.erb +++ b/lib/puppet/face/help/face.erb diff --git a/lib/puppet/faces/help/global.erb b/lib/puppet/face/help/global.erb index e123367a2..f4c761b2b 100644 --- a/lib/puppet/faces/help/global.erb +++ b/lib/puppet/face/help/global.erb @@ -1,8 +1,8 @@ puppet <subcommand> [options] <action> [options] Available subcommands, from Puppet Faces: -% Puppet::Faces.faces.sort.each do |name| -% face = Puppet::Faces[name, :current] +% Puppet::Face.faces.sort.each do |name| +% face = Puppet::Face[name, :current] <%= face.name.to_s.ljust(16) %> <%= face.summary %> % end diff --git a/lib/puppet/faces/indirector.rb b/lib/puppet/face/indirector.rb index 7e4e0f00f..f48611e4b 100644 --- a/lib/puppet/faces/indirector.rb +++ b/lib/puppet/face/indirector.rb @@ -1,7 +1,7 @@ require 'puppet' -require 'puppet/faces' +require 'puppet/face' -class Puppet::Faces::Indirector < Puppet::Faces +class Puppet::Face::Indirector < Puppet::Face option "--terminus TERMINUS" do desc "REVISIT: You can select a terminus, which has some bigger effect that we should describe in this file somehow." diff --git a/lib/puppet/face/key.rb b/lib/puppet/face/key.rb new file mode 100644 index 000000000..3a11ddb03 --- /dev/null +++ b/lib/puppet/face/key.rb @@ -0,0 +1,4 @@ +require 'puppet/face/indirector' + +Puppet::Face::Indirector.define(:key, '0.0.1') do +end diff --git a/lib/puppet/face/node.rb b/lib/puppet/face/node.rb new file mode 100644 index 000000000..fd1a548d6 --- /dev/null +++ b/lib/puppet/face/node.rb @@ -0,0 +1,5 @@ +require 'puppet/face/indirector' + +Puppet::Face::Indirector.define(:node, '0.0.1') do + set_default_format :yaml +end diff --git a/lib/puppet/faces/report.rb b/lib/puppet/face/report.rb index 23a518981..6e6f0b335 100644 --- a/lib/puppet/faces/report.rb +++ b/lib/puppet/face/report.rb @@ -1,6 +1,6 @@ -require 'puppet/faces/indirector' +require 'puppet/face/indirector' -Puppet::Faces::Indirector.define(:report, '0.0.1') do +Puppet::Face::Indirector.define(:report, '0.0.1') do action(:submit) do when_invoked do |report, options| begin diff --git a/lib/puppet/face/resource.rb b/lib/puppet/face/resource.rb new file mode 100644 index 000000000..d162f728a --- /dev/null +++ b/lib/puppet/face/resource.rb @@ -0,0 +1,4 @@ +require 'puppet/face/indirector' + +Puppet::Face::Indirector.define(:resource, '0.0.1') do +end diff --git a/lib/puppet/face/resource_type.rb b/lib/puppet/face/resource_type.rb new file mode 100644 index 000000000..0cdbd719f --- /dev/null +++ b/lib/puppet/face/resource_type.rb @@ -0,0 +1,4 @@ +require 'puppet/face/indirector' + +Puppet::Face::Indirector.define(:resource_type, '0.0.1') do +end diff --git a/lib/puppet/face/status.rb b/lib/puppet/face/status.rb new file mode 100644 index 000000000..7085e7cd7 --- /dev/null +++ b/lib/puppet/face/status.rb @@ -0,0 +1,4 @@ +require 'puppet/face/indirector' + +Puppet::Face::Indirector.define(:status, '0.0.1') do +end diff --git a/lib/puppet/faces/certificate_request.rb b/lib/puppet/faces/certificate_request.rb deleted file mode 100644 index 5e91bdb7f..000000000 --- a/lib/puppet/faces/certificate_request.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'puppet/faces/indirector' - -Puppet::Faces::Indirector.define(:certificate_request, '0.0.1') do -end diff --git a/lib/puppet/faces/certificate_revocation_list.rb b/lib/puppet/faces/certificate_revocation_list.rb deleted file mode 100644 index 2f2d72874..000000000 --- a/lib/puppet/faces/certificate_revocation_list.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'puppet/faces/indirector' - -Puppet::Faces::Indirector.define(:certificate_revocation_list, '0.0.1') do -end diff --git a/lib/puppet/faces/configurer.rb b/lib/puppet/faces/configurer.rb deleted file mode 100644 index d40987697..000000000 --- a/lib/puppet/faces/configurer.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'puppet/faces' - -Puppet::Faces.define(:configurer, '0.0.1') do - action(:synchronize) do - when_invoked do |certname, options| - facts = Puppet::Faces[:facts, '0.0.1'].find(certname) - catalog = Puppet::Faces[:catalog, '0.0.1'].download(certname, facts) - report = Puppet::Faces[:catalog, '0.0.1'].apply(catalog) - report - end - end -end diff --git a/lib/puppet/faces/file.rb b/lib/puppet/faces/file.rb deleted file mode 100644 index e8ad18c17..000000000 --- a/lib/puppet/faces/file.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'puppet/faces/indirector' - -Puppet::Faces::Indirector.define(:file, '0.0.1') do - set_indirection_name :file_bucket_file -end diff --git a/lib/puppet/faces/key.rb b/lib/puppet/faces/key.rb deleted file mode 100644 index 7b6ad52ac..000000000 --- a/lib/puppet/faces/key.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'puppet/faces/indirector' - -Puppet::Faces::Indirector.define(:key, '0.0.1') do -end diff --git a/lib/puppet/faces/node.rb b/lib/puppet/faces/node.rb deleted file mode 100644 index 7eed0df91..000000000 --- a/lib/puppet/faces/node.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'puppet/faces/indirector' - -Puppet::Faces::Indirector.define(:node, '0.0.1') do - set_default_format :yaml -end diff --git a/lib/puppet/faces/resource.rb b/lib/puppet/faces/resource.rb deleted file mode 100644 index 60b0d94db..000000000 --- a/lib/puppet/faces/resource.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'puppet/faces/indirector' - -Puppet::Faces::Indirector.define(:resource, '0.0.1') do -end diff --git a/lib/puppet/faces/resource_type.rb b/lib/puppet/faces/resource_type.rb deleted file mode 100644 index 4321d65e7..000000000 --- a/lib/puppet/faces/resource_type.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'puppet/faces/indirector' - -Puppet::Faces::Indirector.define(:resource_type, '0.0.1') do -end diff --git a/lib/puppet/faces/status.rb b/lib/puppet/faces/status.rb deleted file mode 100644 index e035f281f..000000000 --- a/lib/puppet/faces/status.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'puppet/faces/indirector' - -Puppet::Faces::Indirector.define(:status, '0.0.1') do -end diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb index 27b3584b9..6570ebe46 100644 --- a/lib/puppet/interface.rb +++ b/lib/puppet/interface.rb @@ -19,7 +19,7 @@ class Puppet::Interface # list of directories to search. # Can't we utilize an external autoloader, or simply use the $LOAD_PATH? -pvb def autoloader - @autoloader ||= Puppet::Util::Autoload.new(:application, "puppet/faces") + @autoloader ||= Puppet::Util::Autoload.new(:application, "puppet/face") end def faces @@ -90,7 +90,7 @@ class Puppet::Interface # Try to find actions defined in other files. def load_actions - path = "puppet/faces/#{name}" + path = "puppet/face/#{name}" loaded = [] [path, "#{name}@#{version}/#{path}"].each do |path| @@ -115,6 +115,6 @@ class Puppet::Interface end def to_s - "Puppet::Faces[#{name.inspect}, #{version.inspect}]" + "Puppet::Face[#{name.inspect}, #{version.inspect}]" end end diff --git a/lib/puppet/interface/face_collection.rb b/lib/puppet/interface/face_collection.rb index e4eb22fa3..591471d4b 100644 --- a/lib/puppet/interface/face_collection.rb +++ b/lib/puppet/interface/face_collection.rb @@ -12,7 +12,7 @@ module Puppet::Interface::FaceCollection $LOAD_PATH.each do |dir| next unless FileTest.directory?(dir) Dir.chdir(dir) do - Dir.glob("puppet/faces/*.rb").collect { |f| f.sub(/\.rb/, '') }.each do |file| + Dir.glob("puppet/face/*.rb").collect { |f| f.sub(/\.rb/, '') }.each do |file| iname = file.sub(/\.rb/, '') begin require iname @@ -66,7 +66,7 @@ module Puppet::Interface::FaceCollection # We use require to avoid executing the code multiple times, like any # other Ruby library that we might want to use. --daniel 2011-04-06 begin - require "puppet/faces/#{name}" + require "puppet/face/#{name}" # If we wanted :current, we need to index to find that; direct version # requests just work™ as they go. --daniel 2011-04-06 @@ -100,7 +100,7 @@ module Puppet::Interface::FaceCollection @faces[name][:current] = @faces[name][latest_ver] end rescue LoadError => e - raise unless e.message =~ %r{-- puppet/faces/#{name}$} + raise unless e.message =~ %r{-- puppet/face/#{name}$} # ...guess we didn't find the file; return a much better problem. end diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb index fa462ee2d..a884b8658 100644 --- a/lib/puppet/util/command_line.rb +++ b/lib/puppet/util/command_line.rb @@ -70,8 +70,8 @@ module Puppet # Doing this at the top of the file is natural, but causes puppet.rb # to load too early, which causes things to break. This is a nasty # thing, found in #7065. --daniel 2011-04-11 - require 'puppet/faces/help' - puts Puppet::Faces[:help, :current].help + require 'puppet/face' + puts Puppet::Face[:help, :current].help end end diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb index 9d0e0a715..cec8a57d9 100644 --- a/lib/puppet/util/selinux.rb +++ b/lib/puppet/util/selinux.rb @@ -1,4 +1,4 @@ -# Provides utility functions to help interfaces Puppet to SELinux. +# Provides utility functions to help interface Puppet to SELinux. # # This requires the very new SELinux Ruby bindings. These bindings closely # mirror the SELinux C library interface. |
