mandatories masterslaves with consistency and default value is acceptable

This commit is contained in:
Emmanuel Garette 2016-12-07 17:28:31 +01:00
parent 05200b6d5c
commit df90e74819
2 changed files with 13 additions and 1 deletions

View File

@ -753,3 +753,15 @@ def test_consistency_warnings_error():
with warnings.catch_warnings(record=True) as w:
raises(ValueError, "cfg.a = 1")
assert w == []
def test_consistency_network_netmask_mandatory():
a = NetworkOption('a', '', multi=True, properties=('mandatory',), default=[u'0.0.0.0'])
b = NetmaskOption('b', '', multi=True, properties=('mandatory',), default_multi=u'0.0.0.0')
od = OptionDescription('a', '', [a, b])
od.impl_set_group_type(groups.master)
b.impl_add_consistency('network_netmask', a)
c = Config(od)
c.read_only()
c.cfgimpl_get_settings().remove('mandatory')
c.make_dict()

View File

@ -485,7 +485,7 @@ class Settings(object):
elif 'empty' in properties and \
'empty' in setting_properties and \
self._getcontext().cfgimpl_get_values()._isempty(
opt_or_descr, value, force_allow_empty_list=True):
opt_or_descr, value, force_allow_empty_list=True, index=index):
properties.add('mandatory')
# should return 'frozen' only when tried to modify a value
if check_frozen and 'everything_frozen' in setting_properties: