aboutsummaryrefslogtreecommitdiffstats
path: root/opnfv/utils
diff options
context:
space:
mode:
authorJuan Vidal <juan.vidal.allende@ericsson.com>2017-02-20 13:47:59 +0000
committerJuan Vidal <juan.vidal.allende@ericsson.com>2017-02-20 13:51:53 +0000
commit5578128a47232c3be5c7b810530167b3ba346ecc (patch)
treec1a1456791526cf6f1bf940282d5991918183c8a /opnfv/utils
parentbb67bf0617432cb902d4299c9f77559b0b22a7e9 (diff)
Fix dump_ovs_flows crashing when no nodes are passed
Although it makes no sense that the lists of controller/compute nodes are empty, the function should not crash. This check ensures that the directory where the logs are written to is always created before dumping anything. Change-Id: I3a1fd8ac8ab983decb0bc227a2a22286ff5e34ce Signed-off-by: Juan Vidal <juan.vidal.allende@ericsson.com>
Diffstat (limited to 'opnfv/utils')
-rw-r--r--opnfv/utils/ovs_logger.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/opnfv/utils/ovs_logger.py b/opnfv/utils/ovs_logger.py
index d650eb9..7777a9a 100644
--- a/opnfv/utils/ovs_logger.py
+++ b/opnfv/utils/ovs_logger.py
@@ -101,19 +101,13 @@ class OVSLogger(object):
if timestamp is None:
timestamp = time.strftime("%Y%m%d-%H%M%S")
- for controller_client in controller_clients:
- self.ofctl_dump_flows(controller_client,
- timestamp=timestamp)
- self.vsctl_show(controller_client,
- timestamp=timestamp)
-
- for compute_client in compute_clients:
- self.ofctl_dump_flows(compute_client,
- timestamp=timestamp)
- self.vsctl_show(compute_client,
- timestamp=timestamp)
+ clients = controller_clients + compute_clients
+ for client in clients:
+ self.ofctl_dump_flows(client, timestamp=timestamp)
+ self.vsctl_show(client, timestamp=timestamp)
if related_error is not None:
dumpdir = os.path.join(self.ovs_dir, timestamp)
+ self.__mkdir_p(dumpdir)
with open(os.path.join(dumpdir, 'error'), 'w') as f:
f.write(related_error)