diff options
author | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-08-03 19:31:15 +0000 |
---|---|---|
committer | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-08-03 19:31:15 +0000 |
commit | 877282e8e9e067483fe0c7384ac8e4643dd495df (patch) | |
tree | cb9e2e92445a82f9952783c7b8eb8d48c6e9a3c9 /lib/puppet | |
parent | 81d690ad006248b6194f380d0dc21f6124199557 (diff) | |
download | puppet-877282e8e9e067483fe0c7384ac8e4643dd495df.tar.gz puppet-877282e8e9e067483fe0c7384ac8e4643dd495df.tar.xz puppet-877282e8e9e067483fe0c7384ac8e4643dd495df.zip |
Undo previous commit, which was an error
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2735 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/rails/host.rb | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb index 0c646957f..ca1e10c93 100644 --- a/lib/puppet/rails/host.rb +++ b/lib/puppet/rails/host.rb @@ -3,7 +3,7 @@ require 'puppet/rails/fact_name' require 'puppet/rails/source_file' require 'puppet/util/rails/collection_merger' -Puppet::TIME_DEBUG = true +# Puppet::TIME_DEBUG = true class Puppet::Rails::Host < ActiveRecord::Base include Puppet::Util @@ -43,7 +43,7 @@ class Puppet::Rails::Host < ActiveRecord::Base host = new(:name => name) end } - Puppet.notice(" Search host #{name} : %0.2f s" % seconds) if defined?(Puppet::TIME_DEBUG) + Puppet.notice("Searched for host in %0.2f seconds" % seconds) if defined?(Puppet::TIME_DEBUG) if ip = hash[:facts]["ipaddress"] host.ip = ip end @@ -58,7 +58,7 @@ class Puppet::Rails::Host < ActiveRecord::Base seconds = Benchmark.realtime { host.setresources(hash[:resources]) } - Puppet.notice(" Handled %2d resources: %0.2f s" % [hash[:resources].size, seconds]) if defined?(Puppet::TIME_DEBUG) + Puppet.notice("Handled resources in %0.2f seconds" % seconds) if defined?(Puppet::TIME_DEBUG) host.last_compile = Time.now @@ -127,7 +127,7 @@ class Puppet::Rails::Host < ActiveRecord::Base # Preload the parameters with the resource query, but not the tags, since doing so makes the query take about 10x longer. # I've left the other queries in so that it's straightforward to switch between them for testing, if we so desire. - #existing = resources.find(:all, :include => [{:param_values => :param_name}, {:resource_tags => :puppet_tag}, :source_file]).inject({}) do | hash, resource | + #existing = resources.find(:all, :include => [{:param_values => :param_name, :resource_tags => :puppet_tag}, :source_file]).inject({}) do | hash, resource | #existing = resources.find(:all, :include => [{:resource_tags => :puppet_tag}, :source_file]).inject({}) do | hash, resource | existing = resources.find(:all, :include => [{:param_values => :param_name}, :source_file]).inject({}) do | hash, resource | hash[resource.ref] = resource @@ -135,40 +135,21 @@ class Puppet::Rails::Host < ActiveRecord::Base end } - Puppet.notice(" Search : %0.2f s" % seconds) if defined?(Puppet::TIME_DEBUG) + Puppet.notice("Searched for resources in %0.2f seconds" % seconds) if defined?(Puppet::TIME_DEBUG) - compiled = nil - seconds = Benchmark.realtime { compiled = list.inject({}) do |hash, resource| hash[resource.ref] = resource hash end - } - Puppet.notice(" Compile : %0.2f s" % seconds) if defined?(Puppet::TIME_DEBUG) - - seconds = Benchmark.realtime { - def mylog(msg) - logger.info("\e[0;41m#{msg}\e[0m") - end - ar_hash_merge(existing, compiled, :create => Proc.new { |ref, resource| - mylog("** #{self.name} create #{ref}") resource.to_rails(self) - logger.info("****") }, :delete => Proc.new { |resource| - mylog("** #{self.name} delete #{resource.ref}") self.resources.delete(resource) - logger.info("****") }, :modify => Proc.new { |db, mem| - mylog("** #{self.name} modify #{db.ref}") mem.modify_rails(db) - logger.info("****") }) - } - Puppet.notice(" Merge : %0.2f s" % seconds) if defined?(Puppet::TIME_DEBUG) - end def update_connect_time |