lib/puppet/node/catalog.rb in puppet-0.24.0 vs lib/puppet/node/catalog.rb in puppet-0.24.1
- old
+ new
@@ -258,10 +258,12 @@
return result
end
# Make sure all of our resources are "finished".
def finalize
+ make_default_resources
+
@resource_table.values.each { |resource| resource.finish }
write_graph(:resources)
end
@@ -285,10 +287,24 @@
if block_given?
yield(self)
finalize()
end
end
+
+ # Make the default objects necessary for function.
+ def make_default_resources
+ # We have to add the resources to the catalog, or else they won't get cleaned up after
+ # the transaction.
+
+ # First create the default scheduling objects
+ Puppet::Type.type(:schedule).mkdefaultschedules.each { |res| add_resource(res) unless resource(res.ref) }
+
+ # And filebuckets
+ if bucket = Puppet::Type.type(:filebucket).mkdefaultbucket
+ add_resource(bucket)
+ end
+ end
# Create a graph of all of the relationships in our catalog.
def relationship_graph
raise(Puppet::DevError, "Tried get a relationship graph for a relationship graph") if self.is_relationship_graph
@@ -363,9 +379,14 @@
if resource = @resource_table[ref]
return resource
elsif defined?(@relationship_graph) and @relationship_graph
@relationship_graph.resource(ref)
end
+ end
+
+ # Return an array of all resources.
+ def resources
+ @resource_table.keys
end
# Add a tag.
def tag(*names)
names.each do |name|