Fix collectd_openstack.py for None values

Change-Id: I6338d0029da09add66c5ebed92ab452bbccac556
Co-Authored-By: Simon Pasquier <spasquier@mirantis.com>
This commit is contained in:
Swann Croiset 2017-01-10 11:51:35 +01:00
parent a57116a448
commit 2b9dc19865
1 changed files with 5 additions and 1 deletions

View File

@ -345,5 +345,9 @@ class CollectdPlugin(base.Base):
counts = defaultdict(int)
for obj in list_object:
s = group_by_func(obj)
counts[s] += count_func(obj) if count_func else 1
try:
counts[s] += count_func(obj) if count_func else 1
except TypeError:
# Ignore when count_func() doesn't return a number
pass
return counts