From 37459d65c97ec6cf4adc4a835c495410561b2c98 Mon Sep 17 00:00:00 2001 From: Swann Croiset Date: Fri, 20 Jan 2017 17:33:37 +0100 Subject: [PATCH] Fix Pacemaker collectd plugin Error may happen: AttributeError: 'NoneType' object has no attribute 'iter' Change-Id: I58ead0b0a6e9c84df853b7c9c343b661723e99d8 --- .../lma_collector/files/collectd/collectd_pacemaker.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_pacemaker.py b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_pacemaker.py index 37f793a50..e8cb7b238 100644 --- a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_pacemaker.py +++ b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_pacemaker.py @@ -246,7 +246,12 @@ class CrmMonitorPlugin(base.Base): # value because crm_mon doesn't provide the exact number. To estimate # the number of operations applied to a resource, the plugin keeps a # copy of call_ids and compares it with the current value. - for node in root.find('node_history').iter('node'): + + history = root.find('node_history') + if history is None: + return + + for node in history.iter('node'): hostname = shorten_hostname(node.get('name')) if hostname not in self.history: self.history[hostname] = {}