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
This commit is contained in:
luke 2007-08-05 17:57:31 +00:00
Родитель 3d629bb2b2
Коммит 7bda32e9fb
3 изменённых файлов: 37 добавлений и 1 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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$