diff options
Diffstat (limited to 'lib/puppet/parser/collector.rb')
-rw-r--r-- | lib/puppet/parser/collector.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb index 5f11a6cea..a7f81b4e7 100644 --- a/lib/puppet/parser/collector.rb +++ b/lib/puppet/parser/collector.rb @@ -102,13 +102,20 @@ class Puppet::Parser::Collector raise Puppet::DevError, "Cannot collect resources for a nil host" unless @scope.host host = Puppet::Rails::Host.find_by_name(@scope.host) - query = {:include => {:param_values => :param_name, :puppet_tags => :resource_tags}} + query = {:include => {:param_values => :param_name}} search = "(exported=? AND restype=?)" values = [true, @type] search += " AND (%s)" % @equery if @equery + # this is a small performance optimisation + # the tag mechanism involves 3 more joins, which are + # needed only if we query on tags. + if search =~ /puppet_tags/ + query[:include][:puppet_tags] = :resource_tags + end + # We're going to collect objects from rails, but we don't want any # objects from this host. search = ("host_id != ? AND %s" % search) and values.unshift(host.id) if host |