mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Properly handle salt.utils.config.Null
This commit is contained in:
parent
e0f4706ef6
commit
51e76c3a38
2 changed files with 14 additions and 0 deletions
|
@ -632,6 +632,8 @@ class BaseItem(six.with_metaclass(BaseConfigItemMeta, object)):
|
|||
continue
|
||||
argvalue = self._get_argname_value(argname)
|
||||
if argvalue is not None:
|
||||
if argvalue is Null:
|
||||
argvalue = None
|
||||
# None values are not meant to be included in the
|
||||
# serialization, since this is not None...
|
||||
if self.__serialize_attr_aliases__ and argname in self.__serialize_attr_aliases__:
|
||||
|
|
|
@ -72,6 +72,18 @@ class ConfigTestCase(TestCase):
|
|||
}
|
||||
)
|
||||
|
||||
item = config.BooleanConfig(title='Hungry',
|
||||
description='Are you hungry?',
|
||||
default=config.Null)
|
||||
self.assertDictEqual(
|
||||
item.serialize(), {
|
||||
'type': 'boolean',
|
||||
'title': item.title,
|
||||
'description': item.description,
|
||||
'default': None
|
||||
}
|
||||
)
|
||||
|
||||
@skipIf(HAS_JSONSCHEMA is False, 'The \'jsonschema\' library is missing')
|
||||
def test_boolean_config_validation(self):
|
||||
class TestConf(config.Configuration):
|
||||
|
|
Loading…
Add table
Reference in a new issue