Corrects error message for ping errors from server behavior
* Modified ServerUnreachable message to return whatever message is passed to it * Modified Windows and Linux clients to pass a full failure message rather than just an IP address. Change-Id: Ifc64b28063b1a3584568711f9ff8e4b77b5be399
This commit is contained in:
@@ -57,7 +57,9 @@ class LinuxClient(RemoteInstanceClient):
|
|||||||
break
|
break
|
||||||
time.sleep(retry_interval)
|
time.sleep(retry_interval)
|
||||||
if int(time.time()) - start >= connection_timeout:
|
if int(time.time()) - start >= connection_timeout:
|
||||||
raise ServerUnreachable(ip_address)
|
raise ServerUnreachable(
|
||||||
|
'Could not reach the server at {ip_address}'.format(
|
||||||
|
ip_address=ip_address))
|
||||||
|
|
||||||
if key is not None:
|
if key is not None:
|
||||||
auth_strategy = SSHAuthStrategy.KEY_STRING
|
auth_strategy = SSHAuthStrategy.KEY_STRING
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ class WindowsClient(RemoteInstanceClient):
|
|||||||
if not self._is_instance_reachable(
|
if not self._is_instance_reachable(
|
||||||
ip_address=ip_address, retry_interval=retry_interval,
|
ip_address=ip_address, retry_interval=retry_interval,
|
||||||
timeout=connection_timeout):
|
timeout=connection_timeout):
|
||||||
raise ServerUnreachable(ip_address)
|
raise ServerUnreachable(
|
||||||
|
'Could not reach the server at {ip_address}'.format(
|
||||||
|
ip_address=ip_address))
|
||||||
|
|
||||||
self.ip_address = ip_address
|
self.ip_address = ip_address
|
||||||
self.username = username
|
self.username = username
|
||||||
|
|||||||
@@ -157,15 +157,15 @@ class WinRMConnectionException(Exception):
|
|||||||
def __init__(self, ip_address):
|
def __init__(self, ip_address):
|
||||||
self.message = (
|
self.message = (
|
||||||
'Unable to connect to {ip_address} via WinRM.').format(
|
'Unable to connect to {ip_address} via WinRM.').format(
|
||||||
ip_address=ip_address)
|
ip_address=ip_address)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr(self.message)
|
return repr(self.message)
|
||||||
|
|
||||||
|
|
||||||
class ServerUnreachable(Exception):
|
class ServerUnreachable(Exception):
|
||||||
def __init__(self, address):
|
def __init__(self, message):
|
||||||
self.message = 'Could not reach the server at %s.' % address
|
self.message = message
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr(self.message)
|
return repr(self.message)
|
||||||
|
|||||||
Reference in New Issue
Block a user