summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/gratr/adjacency_graph.rb3
-rw-r--r--lib/puppet/gratr/digraph.rb5
-rw-r--r--lib/puppet/pgraph.rb5
-rw-r--r--lib/puppet/transaction.rb5
4 files changed, 16 insertions, 2 deletions
diff --git a/lib/puppet/gratr/adjacency_graph.rb b/lib/puppet/gratr/adjacency_graph.rb
index 930e2abac..bea50e8c8 100644
--- a/lib/puppet/gratr/adjacency_graph.rb
+++ b/lib/puppet/gratr/adjacency_graph.rb
@@ -178,6 +178,9 @@ module GRATR
alias graph_adjacent adjacent
def adjacent(x, options={})
+ unless @vertex_dict.has_key?(x)
+ raise ArgumentError, "%s is not a vertex" % x
+ end
options[:direction] ||= :out
if !x.kind_of?(GRATR::Edge) and (options[:direction] == :out || !directed?)
if options[:type] == :edges
diff --git a/lib/puppet/gratr/digraph.rb b/lib/puppet/gratr/digraph.rb
index 2c4850d43..ae875376d 100644
--- a/lib/puppet/gratr/digraph.rb
+++ b/lib/puppet/gratr/digraph.rb
@@ -68,7 +68,10 @@ module GRATR
# Reverse all edges in a graph
def reversal
return new(self) unless directed?
- edges.inject(self.class.new) {|a,e| a << e.reverse}
+ result = self.class.new
+ edges.inject(result) {|a,e| a << e.reverse}
+ vertices.each { |v| result.add_vertex!(v) unless result.vertex?(v) }
+ result
end
# Return true if the Graph is oriented.
diff --git a/lib/puppet/pgraph.rb b/lib/puppet/pgraph.rb
index 58bee8605..bf156ed2d 100644
--- a/lib/puppet/pgraph.rb
+++ b/lib/puppet/pgraph.rb
@@ -68,7 +68,10 @@ class Puppet::PGraph < GRATR::Digraph
next unless vertex.is_a?(type)
leaves = other.leaves(vertex)
- next if leaves.empty?
+ if leaves.empty?
+ remove_vertex!(vertex)
+ next
+ end
# First create new edges for each of the :in edges
adjacent(vertex, :direction => :in, :type => :edges).each do |edge|
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index adb5eb134..d6d1669a1 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -143,6 +143,10 @@ class Transaction
def eval_resource(resource)
events = []
+ if resource.is_a?(Puppet::Type::Component)
+ raise Puppet::DevError, "Got a component to evaluate"
+ end
+
if skip?(resource)
@resourcemetrics[:skipped] += 1
else
@@ -231,6 +235,7 @@ class Transaction
# enough to check the immediate dependencies, which is why we use
# a tree from the reversed graph.
skip = false
+ resource.info "checking for failed deps"
@relgraph.reversal.tree_from_vertex(resource, :dfs).keys.each do |dep|
if fails = failed?(dep)
resource.notice "Dependency %s[%s] has %s failures" %