return repr(dump)
#------------------------------------------------------
- def __init__( self, logger = None, , ignore_empty_object_props = True ):
+ def __init__( self, logger = None, ignore_empty_object_props = True ):
"Constructor."
# Logging-Setup
verifier = NagiosObjectVerifier( logger = self.logger )
res = None
args = { 'file': file, 'row': rownum }
+ check_type = None
# Generic properties for inheritance
generic_property = {
}
if key in generic_property:
- try:
- res = verifier.verify_property( value, generic_property[key], args )
- return ( key, res )
- except NagiosVerifyError as e:
- raise NagiosConfigStructError( "Property error for {0} definition: {1}".format( object_type, e ) )
-
- checktype_tupel = self.get_key_checktype( key, object_type )
- if checktype_tupel is None:
- raise NagiosConfigStructError( "Invalid key {0!r} for hosttype {1!r}.".format( key, object_type ) )
-
- if checktype_tupel[1] is not None:
- for argkey in checktype_tupel[1]:
- argval = checktype_tupel[1][argkey]
- args[argkey] = argval
-
- if args['deprecated']:
+
+ check_type = generic_property[key]
+
+ else:
+
+ checktype_tupel = self.get_key_checktype( key, object_type )
+ if checktype_tupel is None:
+ raise NagiosConfigStructError( "Invalid key {0!r} for hosttype {1!r}.".format( key, object_type ) )
+
+ check_type = checktype_tupel[0]
+
+ if checktype_tupel[1] is not None:
+ for argkey in checktype_tupel[1]:
+ argval = checktype_tupel[1][argkey]
+ args[argkey] = argval
+
+ if 'deprecated' in args and args['deprecated']:
self.logger.warn( "Using of a deprecated {0} property {1!r} in {2!r}({3}).".format(
object_type, key, file, rownum) )
+ if value is None:
+ return ( key, None )
+
try:
- res = verifier.verify_property( value, checktype_tupel[0], args )
+ res = verifier.verify_property( value, check_type, args )
except NagiosVerifyError as e:
raise NagiosConfigStructError( "Property error for {0} definition: {1}".format( object_type, e ) )
},
'hostextinfo': {
'host_name': ( 'string', None ),
+ 'hostgroup_name': ( 'array', { 'deprecated': True, } ),
'notes': ( 'string', None ),
'notes_url': ( 'string', None ),
'action_url': ( 'string', None ),