diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-07-04 12:49:11 +0200 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-07-18 10:31:10 +1000 |
commit | a06094ea0f3a38446859de55100ac7fdb0488a9d (patch) | |
tree | f59e75605d9050d4632cede29a8cd086b407b570 /lib/puppet/rails | |
parent | b2a008e30ea57f0c94d605de855c45c0fdf0e5ce (diff) | |
download | puppet-a06094ea0f3a38446859de55100ac7fdb0488a9d.tar.gz puppet-a06094ea0f3a38446859de55100ac7fdb0488a9d.tar.xz puppet-a06094ea0f3a38446859de55100ac7fdb0488a9d.zip |
Feature #2378 - Implement "thin_storeconfigs"
Thin storeconfigs is a limited version of storeconfigs that is
more performant and still allows the exported/collected resources
system wich is the primary use of storeconfigs.
It works by storing to the database only the exported resources, tags
and host facts.
Since usually those exported resources are less than the number
of total resources for a node, it is expected to be faster than
regular storeconfigs (especially for the first run).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet/rails')
-rw-r--r-- | lib/puppet/rails/host.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb index 14ad5e6aa..d66fd2ed7 100644 --- a/lib/puppet/rails/host.rb +++ b/lib/puppet/rails/host.rb @@ -145,6 +145,9 @@ class Puppet::Rails::Host < ActiveRecord::Base # Set our resources. def merge_resources(list) + # keep only exported resources in thin_storeconfig mode + list = list.select { |r| r.exported? } if Puppet.settings[:thin_storeconfigs] + resources_by_id = nil debug_benchmark("Searched for resources") { resources_by_id = find_resources() @@ -160,7 +163,9 @@ class Puppet::Rails::Host < ActiveRecord::Base end def find_resources - resources.find(:all, :include => :source_file).inject({}) do | hash, resource | + condition = { :exported => true } if Puppet.settings[:thin_storeconfigs] + + resources.find(:all, :include => :source_file, :conditions => condition || {}).inject({}) do | hash, resource | hash[resource.id] = resource hash end |