From 570da996057f0f21915560e8852fcdaffa0b018c Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sat, 2 Sep 2023 01:36:17 -0400 Subject: [PATCH] Avoid failures if no children found --- .../pvcnoded/objects/MonitoringInstance.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/node-daemon/pvcnoded/objects/MonitoringInstance.py b/node-daemon/pvcnoded/objects/MonitoringInstance.py index d3ad4aee..5a131baa 100644 --- a/node-daemon/pvcnoded/objects/MonitoringInstance.py +++ b/node-daemon/pvcnoded/objects/MonitoringInstance.py @@ -317,18 +317,20 @@ class MonitoringInstance(object): return # Clean up any old plugin data for which a plugin file no longer exists - for plugin_key in self.zkhandler.children( + plugins_data = self.zkhandler.children( ("node.monitoring.data", self.this_node.name) - ): - if plugin_key not in self.all_plugin_names: - self.zkhandler.delete( - ( - "node.monitoring.data", - self.this_node.name, - "monitoring_plugin", - plugin_key, + ) + if plugins_data is not None: + for plugin_key in plugins_data: + if plugin_key not in self.all_plugin_names: + self.zkhandler.delete( + ( + "node.monitoring.data", + self.this_node.name, + "monitoring_plugin", + plugin_key, + ) ) - ) def run_plugin(self, plugin): time_start = datetime.now()