summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-11-29 11:56:40 -0800
committerPaul Berry <paul@puppetlabs.com>2010-11-29 12:08:26 -0800
commit71ecad9904c8c48c023e90e5fbea5b26b180c9cf (patch)
tree7109f1605e4dceca9e48ef58b41bda559ba4901d /lib/puppet/application
parent14f8160674628340ccfd79baeb84f66cf1e0398a (diff)
Maint: Refactor code to use <class>.indirection.<method>
Replaced uses of the find, search, destroy, and expire methods on model classes with direct calls to the indirection objects. Also removed the old methods that delegated to the indirection object.
Diffstat (limited to 'lib/puppet/application')
-rw-r--r--lib/puppet/application/agent.rb7
-rw-r--r--lib/puppet/application/apply.rb8
-rw-r--r--lib/puppet/application/kick.rb4
-rw-r--r--lib/puppet/application/master.rb4
-rw-r--r--lib/puppet/application/queue.rb4
-rw-r--r--lib/puppet/application/resource.rb4
6 files changed, 15 insertions, 16 deletions
diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb
index c5ad72068..96f33296f 100644
--- a/lib/puppet/application/agent.rb
+++ b/lib/puppet/application/agent.rb
@@ -228,9 +228,9 @@ class Puppet::Application::Agent < Puppet::Application
# access to the local files and we don't need a ca.
Puppet::SSL::Host.ca_location = options[:fingerprint] ? :none : :remote
- Puppet::Transaction::Report.terminus_class = :rest
+ Puppet::Transaction::Report.indirection.terminus_class = :rest
# we want the last report to be persisted locally
- Puppet::Transaction::Report.cache_class = :yaml
+ Puppet::Transaction::Report.indirection.cache_class = :yaml
# Override the default; puppetd needs this, usually.
# You can still override this on the command-line with, e.g., :compiler.
@@ -239,8 +239,7 @@ class Puppet::Application::Agent < Puppet::Application
# Override the default.
Puppet[:facts_terminus] = :facter
- Puppet::Resource::Catalog.cache_class = :yaml
-
+ Puppet::Resource::Catalog.indirection.cache_class = :yaml
# We need tomake the client either way, we just don't start it
# if --no-client is set.
diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb
index 8ec3fab6b..e5b4bb5b7 100644
--- a/lib/puppet/application/apply.rb
+++ b/lib/puppet/application/apply.rb
@@ -85,12 +85,12 @@ class Puppet::Application::Apply < Puppet::Application
end
# Collect our facts.
- unless facts = Puppet::Node::Facts.find(Puppet[:certname])
+ unless facts = Puppet::Node::Facts.indirection.find(Puppet[:certname])
raise "Could not find facts for #{Puppet[:certname]}"
end
# Find our Node
- unless node = Puppet::Node.find(Puppet[:certname])
+ unless node = Puppet::Node.indirection.find(Puppet[:certname])
raise "Could not find node #{Puppet[:certname]}"
end
@@ -112,7 +112,7 @@ class Puppet::Application::Apply < Puppet::Application
begin
# Compile our catalog
starttime = Time.now
- catalog = Puppet::Resource::Catalog.find(node.name, :use_node => node)
+ catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node)
# Translate it to a RAL catalog
catalog = catalog.to_ral
@@ -149,7 +149,7 @@ class Puppet::Application::Apply < Puppet::Application
end
# we want the last report to be persisted locally
- Puppet::Transaction::Report.cache_class = :yaml
+ Puppet::Transaction::Report.indirection.cache_class = :yaml
if options[:debug]
Puppet::Util::Log.level = :debug
diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb
index 37aeb1ef2..c6c6fd782 100644
--- a/lib/puppet/application/kick.rb
+++ b/lib/puppet/application/kick.rb
@@ -175,12 +175,12 @@ class Puppet::Application::Kick < Puppet::Application
if Puppet[:node_terminus] == "ldap" and (options[:all] or @classes)
if options[:all]
- @hosts = Puppet::Node.search("whatever", :fqdn => options[:fqdn]).collect { |node| node.name }
+ @hosts = Puppet::Node.indirection.search("whatever", :fqdn => options[:fqdn]).collect { |node| node.name }
puts "all: #{@hosts.join(", ")}"
else
@hosts = []
@classes.each do |klass|
- list = Puppet::Node.search("whatever", :fqdn => options[:fqdn], :class => klass).collect { |node| node.name }
+ list = Puppet::Node.indirection.search("whatever", :fqdn => options[:fqdn], :class => klass).collect { |node| node.name }
puts "#{klass}: #{list.join(", ")}"
@hosts += list
diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb
index fde474907..879b66c67 100644
--- a/lib/puppet/application/master.rb
+++ b/lib/puppet/application/master.rb
@@ -51,7 +51,7 @@ class Puppet::Application::Master < Puppet::Application
Puppet::Util::Log.newdestination :console
raise ArgumentError, "Cannot render compiled catalogs without pson support" unless Puppet.features.pson?
begin
- unless catalog = Puppet::Resource::Catalog.find(options[:node])
+ unless catalog = Puppet::Resource::Catalog.indirection.find(options[:node])
raise "Could not compile catalog for #{options[:node]}"
end
@@ -139,7 +139,7 @@ class Puppet::Application::Master < Puppet::Application
Puppet.settings.use :main, :master, :ssl
# Cache our nodes in yaml. Currently not configurable.
- Puppet::Node.cache_class = :yaml
+ Puppet::Node.indirection.cache_class = :yaml
# Configure all of the SSL stuff.
if Puppet::SSL::CertificateAuthority.ca?
diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb
index 239f6b2ad..c7e0ce8cc 100644
--- a/lib/puppet/application/queue.rb
+++ b/lib/puppet/application/queue.rb
@@ -79,7 +79,7 @@ class Puppet::Application::Queue < Puppet::Application
exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
require 'puppet/resource/catalog'
- Puppet::Resource::Catalog.terminus_class = :active_record
+ Puppet::Resource::Catalog.indirection.terminus_class = :active_record
daemon.daemonize if Puppet[:daemonize]
@@ -87,6 +87,6 @@ class Puppet::Application::Queue < Puppet::Application
# class set up, because if storeconfigs is enabled,
# we'll get a loop of continually caching the catalog
# for storage again.
- Puppet::Resource::Catalog.cache_class = nil
+ Puppet::Resource::Catalog.indirection.cache_class = nil
end
end
diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb
index f55caa58a..3a7fdcc37 100644
--- a/lib/puppet/application/resource.rb
+++ b/lib/puppet/application/resource.rb
@@ -76,12 +76,12 @@ class Puppet::Application::Resource < Puppet::Application
text = if name
if params.empty?
- [ Puppet::Resource.find( key ) ]
+ [ Puppet::Resource.indirection.find( key ) ]
else
[ Puppet::Resource.new( type, name, :parameters => params ).save( key ) ]
end
else
- Puppet::Resource.search( key, {} )
+ Puppet::Resource.indirection.search( key, {} )
end.map(&format).join("\n")
if options[:edit]