If the module doesn't specify a type for the option, it is probably
an older module. Make sure that the default value we provide is normalized
to a string, just in case the module declares something like
{
'name': 'my_option',
'default': True,
}
where the default is *not* a string, but an user-set value coming from
the config infrastructure would be a string.
Signed-off-by: Sage Weil <sage@redhat.com>
for o in self.MODULE_OPTIONS:
if 'default' in o:
- self.MODULE_OPTION_DEFAULTS[o['name']] = o['default']
+ if 'type' in o:
+ # we'll assume the declared type matches the
+ # supplied default value's type.
+ self.MODULE_OPTION_DEFAULTS[o['name']] = o['default']
+ else:
+ # module not declaring it's type, so normalize the
+ # default value to be a string for consistent behavior
+ # with default and user-supplied option values.
+ self.MODULE_OPTION_DEFAULTS[o['name']] = str(o['default'])
def __del__(self):
unconfigure_logger(self, self.module_name)