417: def initialize(resources)
418: if resources.is_a?(Puppet::Resource::Catalog)
419: @catalog = resources
420: elsif resources.is_a?(Puppet::SimpleGraph)
421: raise "Transactions should get catalogs now, not SimpleGraph"
422: else
423: raise "Transactions require catalogs"
424: end
425:
426: @resourcemetrics = {
427: :total => @catalog.vertices.length,
428: :out_of_sync => 0,
429: :applied => 0,
430: :skipped => 0,
431: :restarted => 0,
432: :failed_restarts => 0,
433: :scheduled => 0
434: }
435:
436:
437: @timemetrics = Hash.new(0)
438:
439:
440: @triggered = Hash.new { |hash, key|
441: hash[key] = Hash.new(0)
442: }
443:
444:
445: @targets = Hash.new do |hash, key|
446: hash[key] = []
447: end
448:
449:
450: @changes = []
451:
452:
453:
454: @failures = Hash.new do |h, key|
455: h[key] = 0
456: end
457:
458: @report = Report.new
459: @count = 0
460: end