lib/testlab/network.rb in testlab-1.21.1 vs lib/testlab/network.rb in testlab-1.22.0

- old
+ new

@@ -35,16 +35,34 @@ attribute :config, :default => Hash.new attribute :address attribute :bridge + # Execution priority; set the order in which the object should execute when + # performing parallel operations; a higher value priority equates to more + # precedence. Objects with identical priority values will execute in + # parallel. + attribute :priority, :default => 0 + def initialize(*args) @ui = TestLab.ui @ui.logger.debug { "Loading Network" } super(*args) @ui.logger.debug { "Network '#{self.id}' Loaded" } + end + + class << self + + def priority_groups + self.all.map(&:priority).sort.uniq.reverse + end + + def by_priority(priority) + self.all.select{ |n| n.priority == priority } + end + end end end