Fix Pacemaker collectd plugin

Error may happen:
  AttributeError: 'NoneType' object has no attribute 'iter'

Change-Id: I58ead0b0a6e9c84df853b7c9c343b661723e99d8
(cherry picked from commit 37459d65c9)
This commit is contained in:
Swann Croiset 2017-01-20 17:33:37 +01:00
parent 587cda10a7
commit 7c1c9703fd
1 changed files with 6 additions and 1 deletions

View File

@ -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] = {}