diff options
author | George Kraft <george.kraft@calxeda.com> | 2013-12-10 17:51:35 -0600 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2013-12-10 17:51:35 -0600 |
commit | fb10ac5c717e591ef205a4b7a3aea3395468ff21 (patch) | |
tree | ba65bb7ecf3484f1533009294d84acb0d847ef4e | |
parent | 11fc37627db11a837e16f275de214463c5fe7f44 (diff) | |
download | cxmanage-fb10ac5c717e591ef205a4b7a3aea3395468ff21.tar.gz |
CXMAN-269: Use "0.0" as the primary node ID if 0 doesn't exist
-rw-r--r-- | cxmanage_api/fabric.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/cxmanage_api/fabric.py b/cxmanage_api/fabric.py index 4efe93a..b549a0f 100644 --- a/cxmanage_api/fabric.py +++ b/cxmanage_api/fabric.py @@ -135,17 +135,13 @@ class Fabric(object): self.task_queue = DEFAULT_TASK_QUEUE def __eq__(self, other): - """__eq__() override.""" return (isinstance(other, Fabric) and self.nodes == other.nodes) def __hash__(self): - """__hash__() override.""" return hash(tuple(self.nodes.iteritems())) def __str__(self): - """__str__() override.""" - return 'Fabric Node 0: %s (%d nodes)' % (self.nodes[0].ip_address, - len(self.nodes)) + return 'Fabric %d nodes (%s)' % (len(self.nodes), self.ip_address) @property def tftp(self): @@ -210,7 +206,10 @@ class Fabric(object): :return: Node object for primary node :rtype: Node object """ - return self.nodes[0] + try: + return self.nodes[0] + except KeyError: + return self.nodes["0.0"] def refresh(self, wait=False, timeout=600): """Gets the nodes of this fabric by pulling IP info from a BMC.""" |