follower option with consistency

This commit is contained in:
2019-07-14 10:35:46 +02:00
parent 69384a5e69
commit 73d45f54cf
5 changed files with 24 additions and 5 deletions

View File

@ -282,7 +282,8 @@ class SubConfig(object):
def getattr(self,
name,
option_bag,
from_follower=False):
from_follower=False,
follower_check_length=True):
"""
attribute notation mechanism for accessing the value of an option
:param name: attribute name
@ -314,7 +315,7 @@ class SubConfig(object):
if not from_follower or option_bag.option.impl_getrequires():
self.cfgimpl_get_settings().validate_properties(option_bag)
if option.impl_is_follower() and not from_follower:
if follower_check_length and option.impl_is_follower() and not from_follower:
length = self.cfgimpl_get_length_leadership(option_bag)
follower_len = self.cfgimpl_get_values()._p_.get_max_length(option_bag.path)
if follower_len > length:
@ -323,8 +324,12 @@ class SubConfig(object):
follower_len,
length,
option_bag.index))
else:
length = None
if option.impl_is_follower() and option_bag.index is None:
value = []
if length is None:
length = self.cfgimpl_get_length_leadership(option_bag)
for idx in range(length):
soption_bag = OptionBag()
soption_bag.set_option(option,

View File

@ -154,7 +154,7 @@ msgid ""
"the follower option \"{}\" has greater length ({}) than the leader length "
"({})"
msgstr ""
"l'option suiveuse \"{}\" a une longueur supérieur ({}) à la longueur de "
"l'option suiveuse \"{}\" a une longueur supérieur ({}) à la longueur de "
"l'option leader ({})"
#: tiramisu/config.py:418

View File

@ -686,7 +686,8 @@ class Option(BaseOption):
fromconsistency.append(cons_id)
coption_bag.fromconsistency = fromconsistency
current_value = option_bag.config_bag.context.getattr(path,
coption_bag)
coption_bag,
follower_check_length=False)
if index_ is None and index is not None:
#if self is a follower and current_option is a leader and func not in ALLOWED_CONST_LIST
#return only the value of the leader for isolate follower