active callback's slave verification

This commit is contained in:
Emmanuel Garette 2014-01-28 09:14:56 +01:00
parent 7c8049a8d0
commit 2eb63c917b
2 changed files with 8 additions and 10 deletions

View file

@ -481,7 +481,6 @@ def test_callback_master_and_slaves_slave_list():
assert cfg.val1.val2 == ['val', 'val']
cfg.val1.val1 = ['val1']
#wrong len
print cfg.val1.val2
raises(SlaveError, 'cfg.val1.val2')

View file

@ -1349,15 +1349,14 @@ class OptionDescription(BaseOption, StorageOptionDescription):
raise ValueError(_('master group with wrong'
' master name for {0}'
).format(self.impl_getname()))
#FIXME debut reecriture
##master_callback, master_callback_params = master.impl_get_callback()
#if master._callback is not None and master._callback[1] is not None:
# for key, callbacks in master._callback[1].items():
# for callbk in callbacks:
# if isinstance(callbk, tuple):
# if callbk[0] in slaves:
# raise ValueError(_("callback of master's option shall "
# "not refered a slave's ones"))
master_callback, master_callback_params = master.impl_get_callback()
if master_callback is not None and master_callback_params is not None:
for key, callbacks in master_callback_params.items():
for callbk in callbacks:
if isinstance(callbk, tuple):
if callbk[0] in slaves:
raise ValueError(_("callback of master's option shall "
"not refered a slave's ones"))
master._master_slaves = tuple(slaves)
for child in self.impl_getchildren():
if child != master: