support callback with propertyerror in master for mandatory_warnings
This commit is contained in:
parent
952c880d10
commit
100a0110cd
2 changed files with 18 additions and 3 deletions
|
@ -452,6 +452,19 @@ def test_callback_master_and_slaves_master2():
|
|||
assert cfg.val1.val2 == ['val2']
|
||||
|
||||
|
||||
def test_callback_master_and_slaves_master3():
|
||||
val1 = StrOption('val1', "", multi=True, properties=('mandatory', 'empty'))
|
||||
val2 = StrOption('val2', "", multi=True, default_multi='val2', properties=('expert',))
|
||||
val3 = StrOption('val3', "", multi=True, callback=return_value, callback_params={'': ((val2, False),)})
|
||||
val4 = StrOption('val4', "", multi=True, callback=return_value, callback_params={'': ((val3, False),)})
|
||||
interface1 = OptionDescription('val1', '', [val1, val2, val3, val4])
|
||||
interface1.impl_set_group_type(groups.master)
|
||||
maconfig = OptionDescription('rootconfig', '', [interface1])
|
||||
cfg = Config(maconfig)
|
||||
cfg.read_write()
|
||||
assert list(cfg.cfgimpl_get_values().mandatory_warnings()) == ['val1.val1']
|
||||
|
||||
|
||||
def test_callback_master_and_slaves_master_list():
|
||||
val1 = StrOption('val1', "", multi=True, callback=return_list)
|
||||
val2 = StrOption('val2', "", multi=True)
|
||||
|
|
|
@ -127,7 +127,7 @@ class MasterSlaves(object):
|
|||
force_permissive,
|
||||
validate_properties, slave_path,
|
||||
slave_value, self_properties, index,
|
||||
returns_raise)
|
||||
returns_raise, setting_properties)
|
||||
else:
|
||||
return self._getslave(values, opt, path, validate,
|
||||
force_permissive, trusted_cached_properties,
|
||||
|
@ -136,13 +136,15 @@ class MasterSlaves(object):
|
|||
|
||||
def _getmaster(self, values, opt, path, validate, force_permissive,
|
||||
validate_properties, c_slave_path,
|
||||
c_slave_value, self_properties, index, returns_raise):
|
||||
c_slave_value, self_properties, index, returns_raise,
|
||||
setting_properties):
|
||||
value = values._get_cached_value(opt, path=path, validate=validate,
|
||||
force_permissive=force_permissive,
|
||||
validate_properties=validate_properties,
|
||||
self_properties=self_properties,
|
||||
from_masterslave=True, index=index,
|
||||
returns_raise=True)
|
||||
returns_raise=True,
|
||||
setting_properties=setting_properties)
|
||||
if isinstance(value, Exception):
|
||||
return value
|
||||
if index is None and validate is True:
|
||||
|
|
Loading…
Reference in a new issue