lib/testlab/network/status.rb in testlab-1.4.4 vs lib/testlab/network/status.rb in testlab-1.5.0
- old
+ new
@@ -61,18 +61,22 @@
TestLab::Utility.broadcast(self.address)
end
# Network Bridge State
def state
- exit_code = self.node.exec(%(sudo brctl show #{self.bridge} 2>&1 | grep -i 'No such device'), :ignore_exit_status => true).exit_code
- if (exit_code == 0)
- :not_created
+ if self.node.dead?
+ :unknown
else
- output = self.node.exec(%(sudo ifconfig #{self.bridge} 2>&1 | grep 'MTU'), :ignore_exit_status => true).output.strip
- if ((output =~ /UP/) || (output =~ /RUNNING/))
- :running
+ exit_code = self.node.exec(%(sudo brctl show #{self.bridge} 2>&1 | grep -i 'No such device'), :ignore_exit_status => true).exit_code
+ if (exit_code == 0)
+ :not_created
else
- :stopped
+ output = self.node.exec(%(sudo ifconfig #{self.bridge} 2>&1 | grep 'MTU'), :ignore_exit_status => true).output
+ if ((output =~ /UP/) || (output =~ /RUNNING/))
+ :running
+ else
+ :stopped
+ end
end
end
end
end