diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-08-05 17:57:31 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-08-05 17:57:31 +0000 |
| commit | 7bda32e9fbb6fb63c5f33fa839f03cc305c2b449 (patch) | |
| tree | 0dc12c1f3bad21d7924b72d194dcfd8e7a96a9d6 | |
| parent | 3d629bb2b237a7bd93e70a029739cb68ee6f9c7c (diff) | |
| download | puppet-7bda32e9fbb6fb63c5f33fa839f03cc305c2b449.tar.gz puppet-7bda32e9fbb6fb63c5f33fa839f03cc305c2b449.tar.xz puppet-7bda32e9fbb6fb63c5f33fa839f03cc305c2b449.zip | |
Fixing #731 - we are now correctly only collecting exported resources
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2746 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | CHANGELOG | 3 | ||||
| -rw-r--r-- | lib/puppet/parser/collector.rb | 2 | ||||
| -rwxr-xr-x | test/rails/collection.rb | 33 |
3 files changed, 37 insertions, 1 deletions
@@ -1,3 +1,6 @@ + Collection of resources now correctly only collects exported + resources again. This was broken in 0.23.0. (#731) + 'gen_config' now generates a configuration with all parameters under a heading that matches the process name, rather than keeping section headings. diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb index 62eafdd65..6c49c6d57 100644 --- a/lib/puppet/parser/collector.rb +++ b/lib/puppet/parser/collector.rb @@ -23,7 +23,7 @@ class Puppet::Parser::Collector host = Puppet::Rails::Host.find_by_name(@scope.host) args = {:include => {:param_values => :param_name}} - args[:conditions] = "restype = '%s'" % [@type] + args[:conditions] = "(exported = 't' AND restype = '%s')" % [@type] if @equery args[:conditions] += " AND (%s)" % [@equery] end diff --git a/test/rails/collection.rb b/test/rails/collection.rb index 005d4502c..d878641be 100755 --- a/test/rails/collection.rb +++ b/test/rails/collection.rb @@ -209,6 +209,39 @@ class TestRailsCollection < PuppetTest::TestCase assert(ret.empty?, "Found exports from our own host") end + + # #731 -- we're collecting all resources, not just exported resources. + def test_only_collecting_exported_resources + railsinit + + # Make our configuration + host = Puppet::Rails::Host.new(:name => "myhost") + + host.resources.build(:title => "/tmp/exporttest1", :restype => "file", + :exported => true) + host.resources.build(:title => "/tmp/exporttest2", :restype => "file", + :exported => false) + + host.save + + @scope.host = "otherhost" + + # Now make a collector + coll = nil + assert_nothing_raised do + coll = Puppet::Parser::Collector.new(@scope, "file", nil, nil, :exported) + end + + # And make sure we get nada back + ret = nil + assert_nothing_raised do + ret = coll.collect_exported + end + + names = ret.collect { |res| res.title } + + assert_equal(%w{/tmp/exporttest1}, names, "Collected incorrect resource list") + end end # $Id$ |
