def test_wait_tcp(self, ping): host = '127.0.0.1' port = 65535 timeout = 1 helpers.wait_tcp(host, port, timeout) ping.assert_called_once_with(host=host, port=port)
def bootstrap_and_wait(self): if self.kernel_cmd is None: self.kernel_cmd = self.ext.get_kernel_cmd() self.save() self._start_setup() ip = self.get_ip_address_by_network_name( settings.SSH_CREDENTIALS['admin_network']) wait_tcp(host=ip, port=self.ssh_port, timeout=self.bootstrap_timeout)
def bootstrap_and_wait(self): self.node.start() ip = self.node.get_ip_address_by_network_name( settings.SSH_CREDENTIALS['admin_network']) wait_tcp(host=ip, port=self.node.ssh_port, timeout=self.node.bootstrap_timeout, timeout_msg='Failed to bootstrap centos master') logger.info('Centos cloud image bootstrap complete')
def bootstrap_and_wait(self): self.node.start() ip = self.node.get_ip_address_by_network_name( settings.SSH_CREDENTIALS['admin_network']) helpers.wait_tcp(host=ip, port=self.node.ssh_port, timeout=self.node.bootstrap_timeout, timeout_msg='Failed to bootstrap centos master') logger.info('Centos cloud image bootstrap complete')
def test_wait_tcp(self, sleep, time, ping): host = '127.0.0.1' port = 65535 timeout = 0 helpers.wait_tcp(host, port, timeout) ping.assert_called_once_with(host=host, port=port) time.assert_called_once() sleep.assert_not_called()
def get_admin_remote(self, login=settings.SSH_CREDENTIALS['login'], password=settings.SSH_CREDENTIALS['password']): admin_ip = self.get_admin_ip() admin_node = self.get_admin() helpers.wait_tcp( host=admin_ip, port=admin_node.ssh_port, timeout=180, timeout_msg=("Admin node {ip} is not accessible by SSH." "".format(ip=admin_ip))) return ssh_client.SSHClient( admin_ip, auth=ssh_client.SSHAuth(username=login, password=password))
def find_node_ip(self, node_name): node = self.get_node(name=node_name) for interface in node.interfaces: ip = interface.address_set.get(interface=interface).ip_address try: helpers.wait_tcp( host=ip, port=node.ssh_port, timeout=10, timeout_msg=("Node {ip} is not accessible by SSH." .format(ip=ip))) return ip except error.TimeoutError: pass raise error.DevopsError("Cannot find SSH endpoint for node {0}" .format(node.name))
def get_node_remote(self, node_name, login=settings.SSH_SLAVE_CREDENTIALS['login'], password=settings.SSH_SLAVE_CREDENTIALS['password']): node = self.get_node(name=node_name) ip = self.get_node_ip(node_name) helpers.wait_tcp( host=ip, port=node.ssh_port, timeout=180, timeout_msg="Node {ip} is not accessible by SSH.".format(ip=ip)) return ssh_client.SSHClient( ip, auth=ssh_client.SSHAuth( username=login, password=password, keys=self.get_private_keys()))