diff options
| author | ballman <ballman@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-12 20:06:51 +0000 |
|---|---|---|
| committer | ballman <ballman@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-12 20:06:51 +0000 |
| commit | ea190c1ad966ca28b9383b4163205a2637763c02 (patch) | |
| tree | 8227d7db44523c54c5321b52f6acb2dd323c0142 /lib | |
| parent | 3003aad5f6f18bb569dc95857990fb53806e280c (diff) | |
| download | puppet-ea190c1ad966ca28b9383b4163205a2637763c02.tar.gz puppet-ea190c1ad966ca28b9383b4163205a2637763c02.tar.xz puppet-ea190c1ad966ca28b9383b4163205a2637763c02.zip | |
Changed the host to "eager fetch" all the resources and their associated
tables. Also removed some unecessary lines from resource.rb that were
causng it to re-read information it already loaded from the db.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2568 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/rails/host.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/rails/resource.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb index 43cc9a367..58808b178 100644 --- a/lib/puppet/rails/host.rb +++ b/lib/puppet/rails/host.rb @@ -124,7 +124,9 @@ class Puppet::Rails::Host < ActiveRecord::Base existing = nil seconds = Benchmark.realtime { #existing = resources.find(:all) - existing = resources.find(:all, :include => {:param_names => :param_values}).inject({}) do | hash, resource | + + + existing = resources.find(:all, :include => [{:param_values => :param_name, :resource_tags => :puppet_tag}, :source_file]).inject({}) do | hash, resource | hash[resource.ref] = resource hash end diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb index d2d4ec21f..0287a5a76 100644 --- a/lib/puppet/rails/resource.rb +++ b/lib/puppet/rails/resource.rb @@ -34,7 +34,6 @@ class Puppet::Rails::Resource < ActiveRecord::Base # returns a hash of param_names.name => [param_values] def get_params_hash - param_values = self.param_values.find(:all, :include => :param_name) return param_values.inject({}) do | hash, value | hash[value.param_name.name] ||= [] hash[value.param_name.name] << value @@ -43,8 +42,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base end def get_tag_hash - tags = self.resource_tags.find(:all, :include => :puppet_tag) - return tags.inject({}) do |hash, tag| + return resource_tags.inject({}) do |hash, tag| hash[tag.puppet_tag.name] = tag.puppet_tag.name hash end |
