lib/testlab/network/status.rb in testlab-0.9.1 vs lib/testlab/network/status.rb in testlab-1.0.0

- old
+ new

@@ -16,14 +16,34 @@ :netmask => self.netmask, :provisioners => self.provisioners.map(&:to_s).collect{ |p| p.split('::').last }.join(','), } end + # Debian Network 'interfaces' Start Definition Tag + def def_tag + "#TESTLAB-DEF-#{self.bridge.to_s.upcase}" + end + + # Debian Network 'interfaces' End Definition Tag + def end_tag + "#TESTLAB-END-#{self.bridge.to_s.upcase}" + end + + # Network IP + # + # Returns the IP of the network bridge. + # + # @return [String] The network bridge IP address. def ip TestLab::Utility.ip(self.address) end + # Network CIDR + # + # Returns the CIDR of the network bridge. + # + # @return [Integer] The network bridge CIDR address. def cidr TestLab::Utility.cidr(self.address) end # Returns the network mask @@ -41,14 +61,14 @@ TestLab::Utility.broadcast(self.address) end # Network Bridge State def state - 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 + exit_code = self.node.ssh.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 - output = self.node.ssh.exec(%(sudo ifconfig #{self.bridge} 2>&1 | grep 'MTU'), :silence => true, :ignore_exit_status => true).output.strip + output = self.node.ssh.exec(%(sudo ifconfig #{self.bridge} 2>&1 | grep 'MTU'), :ignore_exit_status => true).output.strip if ((output =~ /UP/) || (output =~ /RUNNING/)) :running else :stopped end