From 0747b58bfef9c6bb5f1f9ac1eb6a7b3955dac2af Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 30 Nov 2010 12:06:52 -0800 Subject: Maint: Modified uses of indirector.save to call the indirection directly. This change replaces calls to .save with calls to .indirection.save(). This makes the use of the indirector explicit rather than implicit so that it will be easier to search for all indirector call sites using grep. This is an intermediate refactor on the way towards allowing indirector calls to be explicitly routed to multiple termini. This patch affects production code. --- lib/puppet/application/kick.rb | 2 +- lib/puppet/application/queue.rb | 4 ++-- lib/puppet/application/resource.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb index c6c6fd782..12dad653a 100644 --- a/lib/puppet/application/kick.rb +++ b/lib/puppet/application/kick.rb @@ -120,7 +120,7 @@ class Puppet::Application::Kick < Puppet::Application :background => ! options[:foreground], :ignoreschedules => options[:ignoreschedules] } - run = Puppet::Run.new( run_options ).save( url ) + run = Puppet::Run.indirection.save(Puppet::Run.new( run_options ), url) puts "Getting status" result = run.status puts "status is #{result}" diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index c7e0ce8cc..b9e8ca4ca 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -41,12 +41,12 @@ class Puppet::Application::Queue < Puppet::Application require 'puppet/indirector/catalog/queue' # provides Puppet::Indirector::Queue.subscribe Puppet.notice "Starting puppetqd #{Puppet.version}" Puppet::Resource::Catalog::Queue.subscribe do |catalog| - # Once you have a Puppet::Resource::Catalog instance, calling save on it should suffice + # Once you have a Puppet::Resource::Catalog instance, passing it to save should suffice # to put it through to the database via its active_record indirector (which is determined # by the terminus_class = :active_record setting above) Puppet::Util.benchmark(:notice, "Processing queued catalog for #{catalog.name}") do begin - catalog.save + Puppet::Resource::Catalog.indirection.save(catalog) rescue => detail puts detail.backtrace if Puppet[:trace] Puppet.err "Could not save queued catalog for #{catalog.name}: #{detail}" diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index 3a7fdcc37..c7c1c28be 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -78,7 +78,7 @@ class Puppet::Application::Resource < Puppet::Application if params.empty? [ Puppet::Resource.indirection.find( key ) ] else - [ Puppet::Resource.new( type, name, :parameters => params ).save( key ) ] + [ Puppet::Resource.indirection.save(Puppet::Resource.new( type, name, :parameters => params ), key) ] end else Puppet::Resource.indirection.search( key, {} ) -- cgit