diff options
author | evasquez <eric.vasquez@calxeda.com> | 2013-12-16 12:52:58 -0600 |
---|---|---|
committer | evasquez <eric.vasquez@calxeda.com> | 2013-12-16 12:52:58 -0600 |
commit | c30e40cc01ea337e9fa1247d82cbd813119503f5 (patch) | |
tree | 5c83081dcc216ee769da0ae27befcb0039c5e7b6 | |
parent | b9aead6e0612e2fa41624d74d7328d00c052111c (diff) | |
download | cxmanage-c30e40cc01ea337e9fa1247d82cbd813119503f5.tar.gz |
AIT-572: Remove the TimeoutError and raise the actual error upon timeout
Signed-off-by: evasquez <eric.vasquez@calxeda.com>
-rw-r--r-- | cxmanage_api/fabric.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/cxmanage_api/fabric.py b/cxmanage_api/fabric.py index 4a84743..5a922b1 100644 --- a/cxmanage_api/fabric.py +++ b/cxmanage_api/fabric.py @@ -39,8 +39,8 @@ from cxmanage_api.tasks import DEFAULT_TASK_QUEUE from cxmanage_api.tftp import InternalTftp from cxmanage_api.node import Node as NODE from cxmanage_api.credentials import Credentials -from cxmanage_api.cx_exceptions import CommandFailedError, TimeoutError, \ - IpmiError, TftpException, ParseError +from cxmanage_api.cx_exceptions import CommandFailedError, IpmiError, \ + TftpException, ParseError, TimeoutError # pylint: disable=R0902,R0903, R0904 @@ -235,19 +235,22 @@ class Fabric(object): old_nodes = {node.guid: node for node in self._nodes.values()} if wait: + error = None deadline = time.time() + timeout while time.time() < deadline: try: new_nodes = get_nodes() if len(new_nodes) >= initial_node_count: break - except (IpmiError, TftpException, ParseError): - pass + except (IpmiError, TftpException, ParseError) as err: + error = err else: - raise TimeoutError( - "Fabric refresh timed out. Rediscovered %i of %i nodes" - % (len(new_nodes), initial_node_count) - ) + if (error): + raise error + else: + raise TimeoutError( + 'Timeout after %s seconds occurred.' % timeout + ) else: new_nodes = get_nodes() |