diff options
author | George Kraft <george.kraft@calxeda.com> | 2013-11-04 10:09:19 -0600 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2013-11-04 10:09:19 -0600 |
commit | 051fe46d3f04f0d344ed766861062544679a567f (patch) | |
tree | 1de10f67eac8eafc6193e868b3f95e7c5c935d0a | |
parent | cbe820b878ace369bca6c9a83f304723ac34224b (diff) | |
download | cxmanage-051fe46d3f04f0d344ed766861062544679a567f.tar.gz |
CXMAN-250: Factor out the empty file check in fabric commands
-rw-r--r-- | cxmanage_api/node.py | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py index cd7dc57..9e2b42d 100644 --- a/cxmanage_api/node.py +++ b/cxmanage_api/node.py @@ -1181,10 +1181,6 @@ communication. if (node_ip_address != "0.0.0.0"): results[node_id] = node_ip_address - # Make sure we found something - if (not results): - raise TftpException("Node failed to reach TFTP server") - return results def get_fabric_macaddrs(self): @@ -1230,10 +1226,6 @@ communication. results[node_id][port] = [] results[node_id][port].append(mac_address) - # Make sure we found something - if (not results): - raise TftpException("Node failed to reach TFTP server") - return results def get_fabric_uplink_info(self): @@ -1268,10 +1260,6 @@ communication. node_data[data[0]] = int(data[1]) results[node_id] = node_data - # Make sure we found something - if (not results): - raise TftpException("Node failed to reach TFTP server") - return results def get_link_stats(self, link=0): @@ -1326,10 +1314,6 @@ communication. ).replace('(link)', '').strip() ] = reg_value[1].strip() - # Make sure we found something - if (not results): - raise TftpException("Node failed to reach TFTP server") - return results def get_linkmap(self): @@ -1357,10 +1341,6 @@ communication. node_id = int(elements[3].strip()) results[link_id] = node_id - # Make sure we found something - if (not results): - raise TftpException("Node failed to reach TFTP server") - return results def get_routing_table(self): @@ -1390,10 +1370,6 @@ communication. rt_entries.append(int(entry)) results[node_id] = rt_entries - # Make sure we found something - if (not results): - raise TftpException("Node failed to reach TFTP server") - return results def get_depth_chart(self): @@ -1441,10 +1417,6 @@ communication. results[target] = dchrt_entries - # Make sure we found something - if (not results): - raise TftpException("Node failed to reach TFTP server") - return results def get_server_ip(self, interface=None, ipv6=False, user="user1", @@ -1587,10 +1559,12 @@ obtained. self.tftp.get_file(src=basename, dest=filename) if (os.path.getsize(filename) > 0): break - except (TftpException, IOError): pass + if os.path.getsize(filename) == 0: + raise TftpException("Node failed to reach TFTP server") + return filename @staticmethod |