lib/testlab/network/status.rb in testlab-0.6.5 vs lib/testlab/network/status.rb in testlab-0.6.6

- old
+ new

@@ -11,11 +11,12 @@ :node_id => self.node.id, :state => self.state, :interface => interface, :broadcast => self.broadcast, :network => self.network, - :netmask => self.netmask + :netmask => self.netmask, + :provisioners => self.provisioners.map(&:to_s).collect{ |p| p.split('::').last }.join(','), } end def ip TestLab::Utility.ip(self.address) @@ -40,14 +41,19 @@ TestLab::Utility.broadcast(self.address) end # Network Bridge State def state - output = self.node.ssh.exec(%(sudo ifconfig #{self.bridge} | grep 'MTU'), :silence => true, :ignore_exit_status => true).output.strip - if ((output =~ /UP/) && (output =~ /RUNNING/)) - :running + exit_code = self.node.ssh.exec(%(sudo brctl show #{self.bridge} 2>&1 | grep -i 'No such device'), :silence => true, :ignore_exit_status => true).exit_code + if (exit_code == 0) + :not_created else - :stopped + output = self.node.ssh.exec(%(sudo ifconfig #{self.bridge} 2>&1 | grep 'MTU'), :silence => true, :ignore_exit_status => true).output.strip + if ((output =~ /UP/) && (output =~ /RUNNING/)) + :running + else + :stopped + end end end end