can get uncalculated property

This commit is contained in:
Emmanuel Garette 2019-12-02 10:40:17 +01:00
parent b6c11c08db
commit 8345a4651d
1 changed files with 5 additions and 5 deletions

View File

@ -424,7 +424,8 @@ class Settings(object):
def getproperties(self, def getproperties(self,
option_bag, option_bag,
apply_requires=True): apply_requires=True,
uncalculated=False):
""" """
""" """
option = option_bag.option option = option_bag.option
@ -433,8 +434,7 @@ class Settings(object):
option = option.impl_getopt() option = option.impl_getopt()
path = option.impl_getpath() path = option.impl_getpath()
index = option_bag.index index = option_bag.index
if apply_requires and not uncalculated:
if apply_requires:
cache = config_bag.context._impl_properties_cache cache = config_bag.context._impl_properties_cache
config_bag_props = config_bag.properties config_bag_props = config_bag.properties
is_cached, props, validated = cache.getcache(path, is_cached, props, validated = cache.getcache(path,
@ -456,7 +456,7 @@ class Settings(object):
index, index,
option.impl_getproperties())) option.impl_getproperties()))
for prop in p_props: for prop in p_props:
if isinstance(prop, str): if uncalculated or isinstance(prop, str):
props.add(prop) props.add(prop)
elif apply_requires: elif apply_requires:
new_prop = prop.execute(option_bag, new_prop = prop.execute(option_bag,
@ -471,7 +471,7 @@ class Settings(object):
raise LeadershipError(_('leader cannot have "{}" property').format(new_prop)) raise LeadershipError(_('leader cannot have "{}" property').format(new_prop))
props.add(new_prop) props.add(new_prop)
props -= self.getpermissives(option_bag) props -= self.getpermissives(option_bag)
if apply_requires and not config_bag.is_unrestraint: if not uncalculated and apply_requires and not config_bag.is_unrestraint:
cache.setcache(path, cache.setcache(path,
index, index,
props, props,