1
0
mirror of https://github.com/Napsty/check_esxi_hardware.git synced 2024-11-25 03:43:49 +01:00

Fix NoneType element bug

Andreas Gottwald sent a patch which fixes an issue, when the CIM element was a "NoneType" element but the plugin wanted to read a string from it. 

    Traceback (most recent call last):
     File "./check_esxi_hardware.py", line 629, in <module>
    verboseoutput("  Element Name = "+elementName)
    TypeError: cannot concatenate 'str' and 'NoneType' objects
This commit is contained in:
Claudio Kuenzler 2015-01-15 15:13:47 +01:00
parent 16b07977ae
commit 60b03332f9

View File

@ -211,6 +211,10 @@
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Output serial number of chassis if a blade server is checked
#@---------------------------------------------------
#@ Date : 20150115
#@ Author : Andreas Gottwald
#@ Reason : Fix NoneType element bug
#@---------------------------------------------------
import sys
import time
@ -219,7 +223,7 @@ import re
import string
from optparse import OptionParser,OptionGroup
version = '20150109'
version = '20150115'
NS = 'root/cimv2'
@ -628,6 +632,8 @@ for classe in ClassesToCheck :
for instance in instance_list :
sensor_value = ""
elementName = instance['ElementName']
if elementName is None :
elementName = 'Unknown'
elementNameValue = elementName
verboseoutput(" Element Name = "+elementName)