def startip_cmd(self): if which("ifconfig") and self.alias: if ':' in self.addr: cmd = [ 'ifconfig', self.ipdev, 'inet6', 'add', '/'.join([self.addr, to_cidr(self.mask)]) ] else: cmd = [ 'ifconfig', self.stacked_dev, self.addr, 'netmask', to_dotted(self.mask), 'up' ] else: cmd = [ rcEnv.syspaths.ip, "addr", "add", '/'.join([self.addr, to_cidr(self.mask)]), "dev", self.ipdev ] ret, out, err = self.vcall(cmd) if ret != 0: return ret, out, err # ip activation may still be incomplete # wait for activation, to avoid startapp scripts to fail binding their listeners for i in range(5, 0, -1): if check_ping(self.addr, timeout=1, count=1): return ret, out, err self.log.error("timed out waiting for ip activation") raise ex.excError
def getaddr(self): if hasattr(self, 'addr'): return n = self.get_node() ips = set(n['public_ips'] + n['private_ips']) if len(ips) == 0: return 0 # find first pinging ip for ip in ips: if check_ping(ip, timeout=1, count=1): self.addr = ip break
def getaddr(self): if self.addr is not None: return n = self.get_node() if n is None: raise ex.excError("could not get node details") ips = set(n.public_ips + n.private_ips) if len(ips) == 0: return 0 # find first pinging ip for ip in ips: if check_ping(ip, timeout=1, count=1): self.addr = ip break return 0
def _ping(self): return check_ping(self.addr, timeout=1)
def ping(self): return check_ping(self.addr, timeout=1, count=1)
def check_ping(self, timeout=5, count=1): self.log.info("checking %s availability" % self.addr) return check_ping(self.addr, timeout=timeout, count=count)
def ping(self): if self.addr is None: return 0 return check_ping(self.addr, timeout=1, count=1)
def ping(self): if not hasattr(self, "addr"): return 0 return check_ping(self.addr, timeout=1, count=1)