reorganise symlinkoption

This commit is contained in:
Emmanuel Garette 2017-12-04 20:05:36 +01:00
parent e40a1e78a2
commit 924ac4e597
9 changed files with 636 additions and 506 deletions

View File

@ -7,7 +7,7 @@ from py.test import raises
from .autopath import do_autopath
do_autopath()
from tiramisu import Config, MetaConfig, \
StrOption, OptionDescription, MasterSlaves, DynOptionDescription, \
StrOption, SymLinkOption, OptionDescription, MasterSlaves, DynOptionDescription, \
getapi, submulti, undefined, owners
from tiramisu.error import PropertiesOptionError, APIError, ConfigError
from tiramisu.api import display_count
@ -71,103 +71,103 @@ def autocheck(func):
@autocheck
def autocheck_option_multi(api, path, confread, confwrite, **kwargs):
def autocheck_option_multi(api, pathread, pathwrite, confread, confwrite, **kwargs):
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
api.option(path).option.ismulti()
api.option(path).option.issubmulti()
api.option(path).option.ismaster()
api.option(path).option.isslave()
api.option(pathread).option.ismulti()
api.option(pathread).option.issubmulti()
api.option(pathread).option.ismaster()
api.option(pathread).option.isslave()
#
api.forcepermissive.option(path).option.ismulti()
api.forcepermissive.option(path).option.issubmulti()
api.forcepermissive.option(path).option.ismaster()
api.forcepermissive.option(path).option.isslave()
api.forcepermissive.option(pathread).option.ismulti()
api.forcepermissive.option(pathread).option.issubmulti()
api.forcepermissive.option(pathread).option.ismaster()
api.forcepermissive.option(pathread).option.isslave()
#
api.unrestraint.option(path).option.ismulti()
api.unrestraint.option(path).option.issubmulti()
api.unrestraint.option(path).option.ismaster()
api.unrestraint.option(path).option.isslave()
api.unrestraint.option(pathread).option.ismulti()
api.unrestraint.option(pathread).option.issubmulti()
api.unrestraint.option(pathread).option.ismaster()
api.unrestraint.option(pathread).option.isslave()
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.option(path).option.ismulti()")
raises(PropertiesOptionError, "api.option(path).option.issubmulti()")
raises(PropertiesOptionError, "api.option(path).option.ismaster()")
raises(PropertiesOptionError, "api.option(path).option.isslave()")
raises(PropertiesOptionError, "api.option(pathread).option.ismulti()")
raises(PropertiesOptionError, "api.option(pathread).option.issubmulti()")
raises(PropertiesOptionError, "api.option(pathread).option.ismaster()")
raises(PropertiesOptionError, "api.option(pathread).option.isslave()")
#
api.forcepermissive.option(path).option.ismulti()
api.forcepermissive.option(path).option.issubmulti()
api.forcepermissive.option(path).option.ismaster()
api.forcepermissive.option(path).option.isslave()
api.forcepermissive.option(pathread).option.ismulti()
api.forcepermissive.option(pathread).option.issubmulti()
api.forcepermissive.option(pathread).option.ismaster()
api.forcepermissive.option(pathread).option.isslave()
#
api.unrestraint.option(path).option.ismulti()
api.unrestraint.option(path).option.issubmulti()
api.unrestraint.option(path).option.ismaster()
api.unrestraint.option(path).option.isslave()
api.unrestraint.option(pathread).option.ismulti()
api.unrestraint.option(pathread).option.issubmulti()
api.unrestraint.option(pathread).option.ismaster()
api.unrestraint.option(pathread).option.isslave()
else:
raises(PropertiesOptionError, "api.option(path).option.ismulti()")
raises(PropertiesOptionError, "api.option(path).option.issubmulti()")
raises(PropertiesOptionError, "api.option(path).option.ismaster()")
raises(PropertiesOptionError, "api.option(path).option.isslave()")
raises(PropertiesOptionError, "api.option(pathread).option.ismulti()")
raises(PropertiesOptionError, "api.option(pathread).option.issubmulti()")
raises(PropertiesOptionError, "api.option(pathread).option.ismaster()")
raises(PropertiesOptionError, "api.option(pathread).option.isslave()")
#
raises(PropertiesOptionError, "api.forcepermissive.option(path).option.ismulti()")
raises(PropertiesOptionError, "api.forcepermissive.option(path).option.issubmulti()")
raises(PropertiesOptionError, "api.forcepermissive.option(path).option.ismaster()")
raises(PropertiesOptionError, "api.forcepermissive.option(path).option.isslave()")
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.ismulti()")
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.issubmulti()")
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.ismaster()")
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.isslave()")
#
api.unrestraint.option(path).option.ismulti()
api.unrestraint.option(path).option.issubmulti()
api.unrestraint.option(path).option.ismaster()
api.unrestraint.option(path).option.isslave()
api.unrestraint.option(pathread).option.ismulti()
api.unrestraint.option(pathread).option.issubmulti()
api.unrestraint.option(pathread).option.ismaster()
api.unrestraint.option(pathread).option.isslave()
@autocheck
def autocheck_default_owner(api, path, confread, confwrite, **kwargs):
def autocheck_default_owner(api, pathread, pathwrite, confread, confwrite, **kwargs):
"""check different value of owner when any value is set to this option
"""
isslave = api.unrestraint.option(path).option.isslave()
isslave = api.unrestraint.option(pathread).option.isslave()
# check if owner is a string "default" and 'isdefault'
def do(conf):
if not isslave:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path).owner.get() == 'default'
assert api.forcepermissive.config(conf).option(path).owner.get() == 'default'
assert api.config(conf).option(pathread).owner.get() == 'default'
assert api.forcepermissive.config(conf).option(pathread).owner.get() == 'default'
#
assert api.config(conf).option(path).owner.isdefault()
assert api.forcepermissive.config(conf).option(path).owner.isdefault()
assert api.config(conf).option(pathread).owner.isdefault()
assert api.forcepermissive.config(conf).option(pathread).owner.isdefault()
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(conf).option(path).owner.get()")
assert api.forcepermissive.config(conf).option(path).owner.get() == 'default'
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
assert api.forcepermissive.config(conf).option(pathread).owner.get() == 'default'
#
raises(PropertiesOptionError, "api.config(conf).option(path).owner.isdefault()")
assert api.forcepermissive.config(conf).option(path).owner.isdefault()
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.isdefault()")
assert api.forcepermissive.config(conf).option(pathread).owner.isdefault()
else:
raises(PropertiesOptionError, "api.config(conf).option(path).owner.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path).owner.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.get()")
#
raises(PropertiesOptionError, "api.config(conf).option(path).owner.isdefault()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path).owner.isdefault()")
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.isdefault()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.isdefault()")
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path, 0).owner.get() == 'default'
assert api.forcepermissive.config(conf).option(path, 0).owner.get() == 'default'
assert api.config(conf).option(pathread, 0).owner.get() == 'default'
assert api.forcepermissive.config(conf).option(pathread, 0).owner.get() == 'default'
#
assert api.config(conf).option(path, 0).owner.isdefault()
assert api.forcepermissive.config(conf).option(path, 0).owner.isdefault()
assert api.config(conf).option(pathread, 0).owner.isdefault()
assert api.forcepermissive.config(conf).option(pathread, 0).owner.isdefault()
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(conf).option(path, 0).owner.get()")
assert api.forcepermissive.config(conf).option(path, 0).owner.get() == 'default'
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).owner.get()")
assert api.forcepermissive.config(conf).option(pathread, 0).owner.get() == 'default'
#
raises(PropertiesOptionError, "api.config(conf).option(path, 0).owner.isdefault()")
assert api.forcepermissive.config(conf).option(path, 0).owner.isdefault()
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).owner.isdefault()")
assert api.forcepermissive.config(conf).option(pathread, 0).owner.isdefault()
else:
raises(PropertiesOptionError, "api.config(conf).option(path, 0).owner.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path, 0).owner.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).owner.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 0).owner.get()")
#
raises(PropertiesOptionError, "api.config(conf).option(path, 0).owner.isdefault()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path, 0).owner.isdefault()")
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).owner.isdefault()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 0).owner.isdefault()")
# unrestraint is not allowed
raises(APIError, "api.unrestraint.config(conf).option(path).owner.get()")
raises(APIError, "api.unrestraint.config(conf).option(path).owner.isdefault()")
raises(APIError, "api.unrestraint.config(conf).option(pathread).owner.get()")
raises(APIError, "api.unrestraint.config(conf).option(pathread).owner.isdefault()")
do(confread)
if confread != confwrite:
do(confwrite)
@ -212,19 +212,19 @@ def _autocheck_default_value(api, path, conf, **kwargs):
@autocheck
def autocheck_default_value(api, path, confread, confwrite, **kwargs):
_autocheck_default_value(api, path, confread, **kwargs)
def autocheck_default_value(api, pathread, pathwrite, confread, confwrite, **kwargs):
_autocheck_default_value(api, pathread, confread, **kwargs)
if confread != confwrite:
_autocheck_default_value(api, path, confwrite, **kwargs)
_autocheck_default_value(api, pathread, confwrite, **kwargs)
def _set_value(api, path, conf, **kwargs):
def _set_value(api, pathwrite, conf, **kwargs):
set_permissive = kwargs.get('set_permissive', True)
multi = api.unrestraint.option(path).option.ismulti()
submulti_ = api.unrestraint.option(path).option.issubmulti()
ismaster = api.unrestraint.option(path).option.ismaster()
isslave = api.unrestraint.option(path).option.isslave()
multi = api.unrestraint.option(pathwrite).option.ismulti()
submulti_ = api.unrestraint.option(pathwrite).option.issubmulti()
ismaster = api.unrestraint.option(pathwrite).option.ismaster()
isslave = api.unrestraint.option(pathwrite).option.isslave()
if not multi:
first_value = FIRST_VALUE
elif submulti_ is False:
@ -243,64 +243,64 @@ def _set_value(api, path, conf, **kwargs):
# for master must append, not set
if ismaster:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
raises(APIError, "api.config(conf).option(path, 0).value.set(first_value[0])")
raises(APIError, "api.config(conf).option(pathwrite, 0).value.set(first_value[0])")
if not set_permissive:
api.config(conf).option(path).value.set([first_value[0]])
api.config(conf).option(pathwrite).value.set([first_value[0]])
else:
api.forcepermissive.config(conf).option(path).value.set([first_value[0]])
api.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]])
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(conf).option(path).value.set([first_value[0]])")
raises(PropertiesOptionError, "api.config(conf).option(pathwrite).value.set([first_value[0]])")
if set_permissive:
api.forcepermissive.config(conf).option(path).value.set([first_value[0]])
api.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]])
else:
raises(PropertiesOptionError, "api.config(conf).option(path).value.set([first_value[0]])")
raises(PropertiesOptionError, "api.config(conf).option(pathwrite).value.set([first_value[0]])")
raises(PropertiesOptionError,
"api.forcepermissive.config(conf).option(path).value.set([first_value[0]])")
raises(APIError, "api.unrestraint.config(conf).option(path).value.set(first_value[1])")
"api.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]])")
raises(APIError, "api.unrestraint.config(conf).option(pathwrite).value.set(first_value[1])")
elif isslave:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
if not set_permissive:
api.config(conf).option(path, 1).value.set(second_value)
api.config(conf).option(pathwrite, 1).value.set(second_value)
else:
api.forcepermissive.config(conf).option(path, 1).value.set(second_value)
api.forcepermissive.config(conf).option(pathwrite, 1).value.set(second_value)
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(conf).option(path, 1).value.set(second_value)")
raises(PropertiesOptionError, "api.config(conf).option(pathwrite, 1).value.set(second_value)")
if set_permissive:
api.forcepermissive.config(conf).option(path, 1).value.set(second_value)
api.forcepermissive.config(conf).option(pathwrite, 1).value.set(second_value)
else:
raises(PropertiesOptionError, "api.config(conf).option(path, 1).value.set(second_value)")
raises(PropertiesOptionError, "api.config(conf).option(pathwrite, 1).value.set(second_value)")
raises(PropertiesOptionError,
"api.forcepermissive.config(conf).option(path, 1).value.set(second_value)")
"api.forcepermissive.config(conf).option(pathwrite, 1).value.set(second_value)")
raises(APIError,
"api.unrestraint.config(conf).option(path).value.set([second_value, second_value])")
"api.unrestraint.config(conf).option(pathwrite).value.set([second_value, second_value])")
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
if not set_permissive:
api.config(conf).option(path).value.set(first_value)
api.config(conf).option(pathwrite).value.set(first_value)
else:
api.forcepermissive.config(conf).option(path).value.set(first_value)
api.forcepermissive.config(conf).option(pathwrite).value.set(first_value)
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(conf).option(path).value.set(first_value)")
raises(PropertiesOptionError, "api.config(conf).option(pathwrite).value.set(first_value)")
if set_permissive:
api.forcepermissive.config(conf).option(path).value.set(first_value)
api.forcepermissive.config(conf).option(pathwrite).value.set(first_value)
else:
raises(PropertiesOptionError, "api.config(conf).option(path).value.set(first_value)")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path).value.set(first_value)")
raises(APIError, "api.unrestraint.config(conf).option(path).value.set(first_value)")
raises(PropertiesOptionError, "api.config(conf).option(pathwrite).value.set(first_value)")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathwrite).value.set(first_value)")
raises(APIError, "api.unrestraint.config(conf).option(pathwrite).value.set(first_value)")
@autocheck
def autocheck_set_value(api, path, confread, confwrite, **kwargs):
_set_value(api, path, confwrite, **kwargs)
def autocheck_set_value(api, pathread, pathwrite, confread, confwrite, **kwargs):
_set_value(api, pathwrite, confwrite, **kwargs)
@autocheck
def autocheck_get_value_permissive(api, path, confread, confwrite, **kwargs):
multi = api.unrestraint.option(path).option.ismulti()
submulti_ = api.unrestraint.option(path).option.issubmulti()
isslave = api.unrestraint.option(path).option.isslave()
_set_value(api, path, confwrite, **kwargs)
def autocheck_get_value_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
multi = api.unrestraint.option(pathread).option.ismulti()
submulti_ = api.unrestraint.option(pathread).option.issubmulti()
isslave = api.unrestraint.option(pathread).option.isslave()
_set_value(api, pathwrite, confwrite, **kwargs)
empty_value = kwargs['default']
if not multi:
first_value = FIRST_VALUE
@ -313,47 +313,47 @@ def autocheck_get_value_permissive(api, path, confread, confwrite, **kwargs):
# get value after set value without permissive
if isslave:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path, 0).value.get() == empty_value
assert api.forcepermissive.config(conf).option(path, 0).value.get() == empty_value
assert api.config(conf).option(pathread, 0).value.get() == empty_value
assert api.forcepermissive.config(conf).option(pathread, 0).value.get() == empty_value
if submulti_:
assert api.config(conf).option(path, 1).value.get() == SUBLIST_SECOND_VALUE[1]
assert api.forcepermissive.config(conf).option(path, 1).value.get() == SUBLIST_SECOND_VALUE[1]
assert api.config(conf).option(pathread, 1).value.get() == SUBLIST_SECOND_VALUE[1]
assert api.forcepermissive.config(conf).option(pathread, 1).value.get() == SUBLIST_SECOND_VALUE[1]
else:
assert api.config(conf).option(path, 1).value.get() == LIST_SECOND_VALUE[1]
assert api.forcepermissive.config(conf).option(path, 1).value.get() == LIST_SECOND_VALUE[1]
assert api.config(conf).option(pathread, 1).value.get() == LIST_SECOND_VALUE[1]
assert api.forcepermissive.config(conf).option(pathread, 1).value.get() == LIST_SECOND_VALUE[1]
elif kwargs.get('permissive', False):
raises(PropertiesOptionError, "assert api.config(conf).option(path, 0).value.get()")
raises(PropertiesOptionError, "assert api.config(conf).option(path, 1).value.get()")
assert api.forcepermissive.config(conf).option(path, 0).value.get() == empty_value
raises(PropertiesOptionError, "assert api.config(conf).option(pathread, 0).value.get()")
raises(PropertiesOptionError, "assert api.config(conf).option(pathread, 1).value.get()")
assert api.forcepermissive.config(conf).option(pathread, 0).value.get() == empty_value
if submulti_:
assert api.forcepermissive.config(conf).option(path, 1).value.get() == SUBLIST_SECOND_VALUE[1]
assert api.forcepermissive.config(conf).option(pathread, 1).value.get() == SUBLIST_SECOND_VALUE[1]
else:
assert api.forcepermissive.config(conf).option(path, 1).value.get() == LIST_SECOND_VALUE[1]
assert api.forcepermissive.config(conf).option(pathread, 1).value.get() == LIST_SECOND_VALUE[1]
else:
raises(PropertiesOptionError, "assert api.config(conf).option(path, 0).value.get()")
raises(PropertiesOptionError, "assert api.config(conf).option(path, 1).value.get()")
raises(PropertiesOptionError, "assert api.forcepermissive.config(conf).option(path, 0).value.get()")
raises(PropertiesOptionError, "assert api.forcepermissive.config(conf).option(path, 1).value.get()")
raises(PropertiesOptionError, "assert api.config(conf).option(pathread, 0).value.get()")
raises(PropertiesOptionError, "assert api.config(conf).option(pathread, 1).value.get()")
raises(PropertiesOptionError, "assert api.forcepermissive.config(conf).option(pathread, 0).value.get()")
raises(PropertiesOptionError, "assert api.forcepermissive.config(conf).option(pathread, 1).value.get()")
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path).value.get() == first_value
assert api.forcepermissive.config(conf).option(path).value.get() == first_value
assert api.config(conf).option(pathread).value.get() == first_value
assert api.forcepermissive.config(conf).option(pathread).value.get() == first_value
elif kwargs.get('permissive', False):
raises(PropertiesOptionError, "api.config(conf).option(path).value.get()")
assert api.forcepermissive.config(conf).option(path).value.get() == first_value
raises(PropertiesOptionError, "api.config(conf).option(pathread).value.get()")
assert api.forcepermissive.config(conf).option(pathread).value.get() == first_value
else:
raises(PropertiesOptionError, "api.config(conf).option(path).value.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path).value.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread).value.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).value.get()")
do(confread)
if confread != confwrite:
do(confwrite)
def _autocheck_get_value(api, path, conf, **kwargs):
def _autocheck_get_value(api, pathread, conf, **kwargs):
set_permissive = kwargs.get('set_permissive', True)
multi = api.unrestraint.option(path).option.ismulti()
submulti_ = api.unrestraint.option(path).option.issubmulti()
isslave = api.unrestraint.option(path).option.isslave()
multi = api.unrestraint.option(pathread).option.ismulti()
submulti_ = api.unrestraint.option(pathread).option.issubmulti()
isslave = api.unrestraint.option(pathread).option.isslave()
empty_value = kwargs['default']
if not multi:
first_value = FIRST_VALUE
@ -372,70 +372,70 @@ def _autocheck_get_value(api, path, conf, **kwargs):
# get value after set value without permissive
if isslave:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path, 0).value.get() == empty_value
assert api.config(conf).option(path, 1).value.get() == second_value
assert api.forcepermissive.config(conf).option(path, 0).value.get() == empty_value
assert api.forcepermissive.config(conf).option(path, 1).value.get() == second_value
assert api.config(conf).option(pathread, 0).value.get() == empty_value
assert api.config(conf).option(pathread, 1).value.get() == second_value
assert api.forcepermissive.config(conf).option(pathread, 0).value.get() == empty_value
assert api.forcepermissive.config(conf).option(pathread, 1).value.get() == second_value
elif kwargs.get('permissive', False):
raises(PropertiesOptionError, "api.config(conf).option(path, 0).value.get()")
assert api.forcepermissive.config(conf).option(path, 0).value.get() == empty_value
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).value.get()")
assert api.forcepermissive.config(conf).option(pathread, 0).value.get() == empty_value
if set_permissive:
assert api.forcepermissive.config(conf).option(path, 1).value.get() == second_value
assert api.forcepermissive.config(conf).option(pathread, 1).value.get() == second_value
else:
assert api.forcepermissive.config(conf).option(path, 1).value.get() == empty_value
assert api.forcepermissive.config(conf).option(pathread, 1).value.get() == empty_value
else:
raises(PropertiesOptionError, "api.config(conf).option(path, 0).value.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path, 0).value.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).value.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 0).value.get()")
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path).value.get() == first_value
assert api.forcepermissive.config(conf).option(path).value.get() == first_value
assert api.config(conf).option(pathread).value.get() == first_value
assert api.forcepermissive.config(conf).option(pathread).value.get() == first_value
elif kwargs.get('permissive', False):
raises(PropertiesOptionError, "api.config(conf).option(path).value.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread).value.get()")
if set_permissive:
assert api.forcepermissive.config(conf).option(path).value.get() == first_value
assert api.forcepermissive.config(conf).option(pathread).value.get() == first_value
else:
assert api.forcepermissive.config(conf).option(path).value.get() == empty_value
assert api.forcepermissive.config(conf).option(pathread).value.get() == empty_value
else:
raises(PropertiesOptionError, "api.config(conf).option(path).value.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path).value.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread).value.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).value.get()")
@autocheck
def autocheck_get_value(api, path, confread, confwrite, **kwargs):
_set_value(api, path, confwrite, set_permissive=False, **kwargs)
_autocheck_get_value(api, path, confread, set_permissive=False, **kwargs)
if path.endswith('val1'):
val2_path = path.replace('val1', 'val2')
def autocheck_get_value(api, pathread, pathwrite, confread, confwrite, **kwargs):
_set_value(api, pathwrite, confwrite, set_permissive=False, **kwargs)
_autocheck_get_value(api, pathread, confread, set_permissive=False, **kwargs)
if pathread.endswith('val1'):
val2_path = pathread.replace('val1', 'val2')
_autocheck_default_value(api, val2_path, confread, **kwargs)
if confread != confwrite:
_autocheck_get_value(api, path, confwrite, set_permissive=False, **kwargs)
if path.endswith('val1'):
_autocheck_get_value(api, pathread, confwrite, set_permissive=False, **kwargs)
if pathread.endswith('val1'):
_autocheck_default_value(api, val2_path, confwrite, **kwargs)
@autocheck
def autocheck_value_slave(api, path, confread, confwrite, **kwargs):
isslave = api.unrestraint.option(path).option.isslave()
def autocheck_value_slave(api, pathread, pathwrite, confread, confwrite, **kwargs):
isslave = api.unrestraint.option(pathread).option.isslave()
if not isslave:
#FIXME raises(APIError, "api.config(confread).option(path).value.len()")
#FIXME raises(APIError, "api.config(confread).option(pathread).value.len()")
return
if kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.option(path).value.len()")
raises(PropertiesOptionError, "api.forcepermissive.option(path).value.len()")
raises(PropertiesOptionError, "api.option(pathread).value.len()")
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).value.len()")
return
multi = api.unrestraint.option(path).option.ismulti()
submulti_ = api.forcepermissive.option(path).option.issubmulti()
multi = api.unrestraint.option(pathread).option.ismulti()
submulti_ = api.forcepermissive.option(pathread).option.issubmulti()
empty_value = kwargs['default']
def do(conf):
if not kwargs.get('permissive', False):
length = api.config(conf).option(path).value.len()
assert api.forcepermissive.config(conf).option(path).value.len() == length
length = api.config(conf).option(pathread).value.len()
assert api.forcepermissive.config(conf).option(pathread).value.len() == length
else:
raises(PropertiesOptionError, "api.config(conf).option(path).value.len()")
length = api.forcepermissive.config(conf).option(path).value.len()
raises(PropertiesOptionError, "api.config(conf).option(pathread).value.len()")
length = api.forcepermissive.config(conf).option(pathread).value.len()
assert length == 2
do(confread)
if confread != confwrite:
@ -444,7 +444,7 @@ def autocheck_value_slave(api, path, confread, confwrite, **kwargs):
length = 2
value = []
for idx in range(length):
value.append(api.forcepermissive.option(path, idx).value.get())
value.append(api.forcepermissive.option(pathread, idx).value.get())
assert value == [empty_value, empty_value]
# cannot access to a slave with index too high
@ -453,22 +453,22 @@ def autocheck_value_slave(api, path, confread, confwrite, **kwargs):
else:
value = SUBLIST_FIRST_VALUE[0]
raises(IndexError, "api.forcepermissive.option(path, length).value.get()")
raises(IndexError, "api.forcepermissive.option(path, length).value.set(value)")
raises(IndexError, "api.forcepermissive.option(path, length).value.reset()")
raises(IndexError, "api.forcepermissive.option(path, length).owner.get()")
raises(IndexError, "api.forcepermissive.option(path, length).owner.isdefault()")
raises(IndexError, "api.forcepermissive.option(path, length).property.get()")
raises(IndexError, "api.forcepermissive.option(path, length).owner.set('new_user')")
raises(IndexError, "api.forcepermissive.option(path, length).property.set(('prop',))")
raises(IndexError, "api.forcepermissive.option(pathread, length).value.get()")
raises(IndexError, "api.forcepermissive.option(pathread, length).value.set(value)")
raises(IndexError, "api.forcepermissive.option(pathread, length).value.reset()")
raises(IndexError, "api.forcepermissive.option(pathread, length).owner.get()")
raises(IndexError, "api.forcepermissive.option(pathread, length).owner.isdefault()")
raises(IndexError, "api.forcepermissive.option(pathread, length).property.get()")
raises(IndexError, "api.forcepermissive.option(pathread, length).owner.set('new_user')")
raises(IndexError, "api.forcepermissive.option(pathread, length).property.set(('prop',))")
@autocheck
def autocheck_reset_value(api, path, confread, confwrite, **kwargs):
def autocheck_reset_value(api, pathread, pathwrite, confread, confwrite, **kwargs):
# check if is a multi, a master or a slave
multi = api.unrestraint.option(path).option.ismulti()
submulti_ = api.unrestraint.option(path).option.issubmulti()
isslave = api.unrestraint.option(path).option.isslave()
multi = api.unrestraint.option(pathread).option.ismulti()
submulti_ = api.unrestraint.option(pathread).option.issubmulti()
isslave = api.unrestraint.option(pathread).option.isslave()
# set default value (different if value is multi or not)
if not multi:
@ -481,59 +481,59 @@ def autocheck_reset_value(api, path, confread, confwrite, **kwargs):
first_value = SUBLIST_FIRST_VALUE
second_value = SUBLIST_SECOND_VALUE
empty_value = kwargs['default']
_set_value(api, path, confwrite, **kwargs)
_set_value(api, pathwrite, confwrite, **kwargs)
# reset value without permissive
if not isslave:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
api.config(confwrite).option(path).value.reset()
api.config(confwrite).option(pathwrite).value.reset()
else:
raises(PropertiesOptionError, "api.config(confwrite).option(path).value.reset()")
raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).value.reset()")
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
api.config(confwrite).option(path, 0).value.reset()
api.config(confwrite).option(pathwrite, 0).value.reset()
else:
raises(PropertiesOptionError, "api.config(confwrite).option(path, 0).value.reset()")
raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite, 0).value.reset()")
# get value after reset value without permissive
def do(conf):
if isslave:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path, 0).value.get() == empty_value
assert api.config(conf).option(path, 1).value.get() == second_value[1]
assert api.config(conf).option(pathread, 0).value.get() == empty_value
assert api.config(conf).option(pathread, 1).value.get() == second_value[1]
elif kwargs.get('permissive', False):
raises(PropertiesOptionError, "api.config(conf).option(path, 0).value.get()")
assert api.forcepermissive.config(conf).option(path, 0).value.get() == empty_value
assert api.forcepermissive.config(conf).option(path, 1).value.get() == second_value[1]
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).value.get()")
assert api.forcepermissive.config(conf).option(pathread, 0).value.get() == empty_value
assert api.forcepermissive.config(conf).option(pathread, 1).value.get() == second_value[1]
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path).value.get() == empty_value
assert api.config(conf).option(pathread).value.get() == empty_value
elif kwargs.get('permissive', False):
raises(PropertiesOptionError, "api.config(conf).option(path).value.get()")
assert api.forcepermissive.config(conf).option(path).value.get() == first_value
raises(PropertiesOptionError, "api.config(conf).option(pathread).value.get()")
assert api.forcepermissive.config(conf).option(pathread).value.get() == first_value
do(confread)
if confread != confwrite:
do(confwrite)
@autocheck
def autocheck_append_value(api, path, confread, confwrite, **kwargs):
ismaster = api.unrestraint.option(path).option.ismaster()
submulti_ = api.unrestraint.option(path).option.issubmulti()
def autocheck_append_value(api, pathread, pathwrite, confread, confwrite, **kwargs):
ismaster = api.unrestraint.option(pathread).option.ismaster()
submulti_ = api.unrestraint.option(pathread).option.issubmulti()
if not ismaster:
return
if not kwargs.get('propertyerror', False):
master_value = api.forcepermissive.config(confread).option(path).value.get()
master_value = api.forcepermissive.config(confread).option(pathread).value.get()
len_value = len(master_value)
master_value.append(undefined)
assert len(api.forcepermissive.config(confread).option(path).value.get()) == len_value
api.forcepermissive.config(confwrite).option(path).value.set(master_value)
new_master_value = api.forcepermissive.config(confread).option(path).value.get()
assert len(api.forcepermissive.config(confread).option(pathread).value.get()) == len_value
api.forcepermissive.config(confwrite).option(pathread).value.set(master_value)
new_master_value = api.forcepermissive.config(confread).option(pathread).value.get()
len_new = len(new_master_value)
assert len_value + 1 == len_new
assert new_master_value[-1] == kwargs['default_multi']
slave_path = path.rsplit('.', 1)[0]
slave_path = pathread.rsplit('.', 1)[0]
if slave_path.endswith('val1') or slave_path.endswith('val2'):
slave_path += '.third' + slave_path[-4:]
else:
@ -546,15 +546,15 @@ def autocheck_append_value(api, path, confread, confwrite, **kwargs):
else:
value = ['value']
master_value.append(value)
assert len(api.forcepermissive.config(confread).option(path).value.get()) == len(new_master_value)
api.forcepermissive.config(confwrite).option(path).value.set(master_value)
assert api.forcepermissive.config(confread).option(path).value.get()[-1] == value
assert len(api.forcepermissive.config(confread).option(pathread).value.get()) == len(new_master_value)
api.forcepermissive.config(confwrite).option(pathread).value.set(master_value)
assert api.forcepermissive.config(confread).option(pathread).value.get()[-1] == value
@autocheck
def autocheck_pop_value(api, path, confread, confwrite, **kwargs):
ismaster = api.unrestraint.option(path).option.ismaster()
submulti_ = api.unrestraint.option(path).option.issubmulti()
def autocheck_pop_value(api, pathread, pathwrite, confread, confwrite, **kwargs):
ismaster = api.unrestraint.option(pathread).option.ismaster()
submulti_ = api.unrestraint.option(pathread).option.issubmulti()
if not ismaster:
return
@ -566,12 +566,12 @@ def autocheck_pop_value(api, path, confread, confwrite, **kwargs):
values = [['value1'], ['value2'], ['value3'], ['value4']]
slave_value = ['slave']
slaves = [kwargs['default_multi'], slave_value, kwargs['default_multi'], kwargs['default_multi']]
a_slave = path.rsplit('.', 1)[0]
a_slave = pathwrite.rsplit('.', 1)[0]
if a_slave.endswith('val1') or a_slave.endswith('val2'):
a_slave += '.third' + a_slave[-4:]
else:
a_slave += '.third'
api.forcepermissive.config(confwrite).option(path).value.set(values)
api.forcepermissive.config(confwrite).option(pathread).value.set(values)
api.forcepermissive.config(confwrite).option(a_slave, 1).value.set(slave_value)
api.forcepermissive.config(confread).option(a_slave, 0).value.get() == kwargs['default_multi']
assert api.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is True
@ -582,7 +582,7 @@ def autocheck_pop_value(api, path, confread, confwrite, **kwargs):
api.forcepermissive.config(confread).option(a_slave, 3).value.get() == kwargs['default_multi']
assert api.forcepermissive.config(confread).option(a_slave, 3).owner.isdefault() is True
#
api.forcepermissive.config(confwrite).option(path).value.pop(3)
api.forcepermissive.config(confwrite).option(pathread).value.pop(3)
api.forcepermissive.config(confread).option(a_slave, 0).value.get() == kwargs['default_multi']
assert api.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is True
api.forcepermissive.config(confread).option(a_slave, 1).value.get() == slave_value
@ -590,46 +590,46 @@ def autocheck_pop_value(api, path, confread, confwrite, **kwargs):
api.forcepermissive.config(confread).option(a_slave, 2).value.get() == kwargs['default_multi']
assert api.forcepermissive.config(confread).option(a_slave, 2).owner.isdefault() is True
#
api.forcepermissive.config(confwrite).option(path).value.pop(0)
api.forcepermissive.config(confwrite).option(pathread).value.pop(0)
api.forcepermissive.config(confread).option(a_slave, 0).value.get() == slave_value
assert api.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is False
api.forcepermissive.config(confread).option(a_slave, 1).value.get() == kwargs['default_multi']
assert api.forcepermissive.config(confread).option(a_slave, 1).owner.isdefault() is True
#
api.forcepermissive.config(confwrite).option(path).value.pop(0)
api.forcepermissive.config(confwrite).option(pathread).value.pop(0)
api.forcepermissive.config(confread).option(a_slave, 0).value.get() == kwargs['default_multi']
assert api.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is True
@autocheck
def autocheck_reset_value_permissive(api, path, confread, confwrite, **kwargs):
def autocheck_reset_value_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
# check if is a multi, a master or a slave
isslave = api.unrestraint.option(path).option.isslave()
_set_value(api, path, confwrite, **kwargs)
isslave = api.unrestraint.option(pathread).option.isslave()
_set_value(api, pathwrite, confwrite, **kwargs)
# reset value with permissive
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
if not isslave:
api.forcepermissive.config(confwrite).option(path).value.reset()
api.forcepermissive.config(confwrite).option(pathwrite).value.reset()
else:
api.forcepermissive.option(path, 1).value.reset()
api.forcepermissive.option(pathwrite, 1).value.reset()
elif kwargs.get('permissive', False):
if not isslave:
api.forcepermissive.config(confwrite).option(path).value.reset()
api.forcepermissive.config(confwrite).option(pathwrite).value.reset()
else:
api.forcepermissive.option(path, 1).value.reset()
api.forcepermissive.option(pathwrite, 1).value.reset()
else:
if not isslave:
raises(PropertiesOptionError, "api.forcepermissive.config(confwrite).option(path).value.reset()")
raises(PropertiesOptionError, "api.forcepermissive.config(confwrite).option(pathwrite).value.reset()")
else:
raises(PropertiesOptionError, "api.forcepermissive.option(path, 1).value.reset()")
_autocheck_default_value(api, path, confread, **kwargs)
raises(PropertiesOptionError, "api.forcepermissive.option(pathwrite, 1).value.reset()")
_autocheck_default_value(api, pathread, confread, **kwargs)
if confread != confwrite:
_autocheck_default_value(api, path, confwrite, **kwargs)
_autocheck_default_value(api, pathread, confwrite, **kwargs)
@autocheck
def autocheck_display(api, path, confread, confwrite, **kwargs):
def autocheck_display(api, pathread, pathwrite, confread, confwrite, **kwargs):
"""re set value
"""
if kwargs['callback']:
@ -642,7 +642,7 @@ def autocheck_display(api, path, confread, confwrite, **kwargs):
assert api.config(confread).config.make_dict() == make_dict
if confread != confwrite:
assert(api.config(confwrite).config.make_dict()) == make_dict
_set_value(api, path, confwrite, **kwargs)
_set_value(api, pathwrite, confwrite, **kwargs)
#print('--')
#print(make_dict_value)
#print(api.config(confread).config.make_dict())
@ -666,63 +666,61 @@ def _getproperties(multi, isslave, kwargs):
return default_props, frozenset(properties)
def _check_default_properties(api, path, conf, kwargs, props_permissive, props):
if not api.unrestraint.option(path).option.isslave():
def _check_default_properties(api, pathread, conf, kwargs, props_permissive, props):
if not api.unrestraint.option(pathread).option.isslave():
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert set(api.config(conf).option(path).property.get()) == set(props_permissive)
assert set(api.config(conf).forcepermissive.option(path).property.get()) == set(props_permissive)
assert set(api.config(conf).option(pathread).property.get()) == set(props_permissive)
assert set(api.config(conf).forcepermissive.option(pathread).property.get()) == set(props_permissive)
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(conf).option(path).property.get()")
assert set(api.forcepermissive.config(conf).option(path).property.get()) == set(props)
raises(PropertiesOptionError, "api.config(conf).option(pathread).property.get()")
assert set(api.forcepermissive.config(conf).option(pathread).property.get()) == set(props)
else:
raises(PropertiesOptionError, "api.config(conf).option(path).property.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path).property.get()")
raises(APIError, "api.unrestraint.option(path).property.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread).property.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).property.get()")
raises(APIError, "api.unrestraint.option(pathread).property.get()")
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert set(api.config(conf).option(path, 0).property.get()) == set(props_permissive)
assert set(api.config(conf).option(path, 1).property.get()) == set(props_permissive)
assert set(api.config(conf).option(pathread, 0).property.get()) == set(props_permissive)
assert set(api.config(conf).option(pathread, 1).property.get()) == set(props_permissive)
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(conf).option(path).property.get()")
assert set(api.forcepermissive.config(conf).option(path, 0).property.get()) == set(props)
assert set(api.forcepermissive.config(conf).option(path, 1).property.get()) == set(props)
raises(PropertiesOptionError, "api.config(conf).option(pathread).property.get()")
assert set(api.forcepermissive.config(conf).option(pathread, 0).property.get()) == set(props)
assert set(api.forcepermissive.config(conf).option(pathread, 1).property.get()) == set(props)
else:
raises(PropertiesOptionError, "api.config(conf).option(path, 0).property.get()")
raises(APIError, "api.unrestraint.option(path, 0).property.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).property.get()")
raises(APIError, "api.unrestraint.option(pathread, 0).property.get()")
@autocheck
def autocheck_property(api, path, confread, confwrite, **kwargs):
def autocheck_property(api, pathread, pathwrite, confread, confwrite, **kwargs):
"""get property from path
"""
# check if is a multi or a slave
multi = api.unrestraint.option(path).option.ismulti()
isslave = api.unrestraint.option(path).option.isslave()
multi = api.unrestraint.option(pathread).option.ismulti()
isslave = api.unrestraint.option(pathread).option.isslave()
default_props, properties = _getproperties(multi, isslave, kwargs)
_check_default_properties(api, path, confread, kwargs, default_props, default_props)
_check_default_properties(api, path, confwrite, kwargs, default_props, default_props)
_check_default_properties(api, pathread, confread, kwargs, default_props, default_props)
_check_default_properties(api, pathread, confwrite, kwargs, default_props, default_props)
# set properties without permissive
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
api.config(confwrite).option(path).property.set(properties)
api.config(confwrite).option(pathwrite).property.set(properties)
else:
raises(PropertiesOptionError, "api.config(confwrite).option(path).property.set(properties)")
raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).property.set(properties)")
_check_default_properties(api, path, confread, kwargs, properties, default_props)
_check_default_properties(api, pathread, confread, kwargs, properties, default_props)
if confread != confwrite:
_check_default_properties(api, path, confwrite, kwargs, properties, default_props)
_check_default_properties(api, pathread, confwrite, kwargs, properties, default_props)
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
raises(ConfigError, "api.config(confread).option(path).property.set(properties)")
raises(ConfigError, "api.config(confread).option(pathread).property.set(properties)")
def _property_permissive(api, path, confread, confwrite, **kwargs):
def _property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
# check if is a multi or a slave
multi = api.unrestraint.option(path).option.ismulti()
isslave = api.unrestraint.option(path).option.isslave()
multi = api.unrestraint.option(pathread).option.ismulti()
isslave = api.unrestraint.option(pathread).option.isslave()
# define properties
properties = copy(PROPERTIES_LIST)
@ -737,359 +735,362 @@ def _property_permissive(api, path, confread, confwrite, **kwargs):
default_props.extend(extra_properties)
default_props, properties = _getproperties(multi, isslave, kwargs)
_check_default_properties(api, path, confwrite, kwargs, default_props, default_props)
_check_default_properties(api, pathread, confwrite, kwargs, default_props, default_props)
if confwrite != confread:
_check_default_properties(api, path, confread, kwargs, default_props, default_props)
_check_default_properties(api, pathread, confread, kwargs, default_props, default_props)
# set properties with permissive
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
api.config(confwrite).option(path).property.set(properties)
api.forcepermissive.config(confwrite).option(path).property.set(properties)
api.config(confwrite).option(pathwrite).property.set(properties)
api.forcepermissive.config(confwrite).option(pathwrite).property.set(properties)
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(confwrite).option(path).property.set(properties)")
api.forcepermissive.config(confwrite).option(path).property.set(properties)
raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).property.set(properties)")
api.forcepermissive.config(confwrite).option(pathwrite).property.set(properties)
else:
raises(PropertiesOptionError, "api.config(confwrite).option(path).property.set(properties)")
raises(PropertiesOptionError, "api.forcepermissive.config(confwrite).option(path).property.set(properties)")
raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).property.set(properties)")
raises(PropertiesOptionError, "api.forcepermissive.config(confwrite).option(pathwrite).property.set(properties)")
_check_default_properties(api, path, confwrite, kwargs, properties, properties)
_check_default_properties(api, pathread, confwrite, kwargs, properties, properties)
if confwrite != confread:
_check_default_properties(api, path, confread, kwargs, properties, properties)
_check_default_properties(api, pathread, confread, kwargs, properties, properties)
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
raises(ConfigError, "api.config(confread).option(path).property.set(properties)")
raises(ConfigError, "api.config(confread).option(pathwrite).property.set(properties)")
@autocheck
def autocheck_property_permissive(api, path, confread, confwrite, **kwargs):
_property_permissive(api, path, confread, confwrite, **kwargs)
def autocheck_property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
_property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs)
@autocheck
def autocheck_reset_property(api, path, confread, confwrite, **kwargs):
def autocheck_reset_property(api, pathread, pathwrite, confread, confwrite, **kwargs):
"""check properties after set with permissive
"""
# check if is a multi or a slave
multi = api.unrestraint.option(path).option.ismulti()
isslave = api.unrestraint.option(path).option.isslave()
multi = api.unrestraint.option(pathread).option.ismulti()
isslave = api.unrestraint.option(pathread).option.isslave()
default_props, properties = _getproperties(multi, isslave, kwargs)
_property_permissive(api, path, confread, confwrite, **kwargs)
_property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs)
# reset properties without permissive
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
api.config(confwrite).option(path).property.reset()
api.config(confwrite).option(pathwrite).property.reset()
else:
raises(PropertiesOptionError, "api.config(confwrite).option(path).property.reset()")
raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).property.reset()")
_check_default_properties(api, path, confread, kwargs, default_props, properties)
_check_default_properties(api, pathread, confread, kwargs, default_props, properties)
if confread != confwrite:
_check_default_properties(api, path, confwrite, kwargs, default_props, properties)
_check_default_properties(api, pathread, confwrite, kwargs, default_props, properties)
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
raises(ConfigError, "api.config(confread).option(path).property.reset()")
raises(ConfigError, "api.config(confread).option(pathread).property.reset()")
@autocheck
def autocheck_reset_property_permissive(api, path, confread, confwrite, **kwargs):
def autocheck_reset_property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
# check if is a multi or a slave
multi = api.unrestraint.option(path).option.ismulti()
isslave = api.unrestraint.option(path).option.isslave()
multi = api.unrestraint.option(pathread).option.ismulti()
isslave = api.unrestraint.option(pathread).option.isslave()
default_props, properties = _getproperties(multi, isslave, kwargs)
_property_permissive(api, path, confread, confwrite, **kwargs)
_property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs)
# reset properties with permissive
raises(APIError, "api.unrestraint.option(path).property.set(properties)")
raises(APIError, "api.unrestraint.option(path).property.reset()")
raises(APIError, "api.unrestraint.option(pathwrite).property.set(properties)")
raises(APIError, "api.unrestraint.option(pathwrite).property.reset()")
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
api.forcepermissive.option(path).property.set(properties)
api.forcepermissive.option(path).property.reset()
api.forcepermissive.option(pathwrite).property.set(properties)
api.forcepermissive.option(pathwrite).property.reset()
elif kwargs.get('permissive', False):
api.forcepermissive.option(path).property.reset()
api.forcepermissive.option(pathwrite).property.reset()
_check_default_properties(api, path, confwrite, kwargs, default_props, default_props)
_check_default_properties(api, pathread, confwrite, kwargs, default_props, default_props)
if confread != confwrite:
_check_default_properties(api, path, confread, kwargs, default_props, default_props)
_check_default_properties(api, pathread, confread, kwargs, default_props, default_props)
@autocheck
def autocheck_context_owner(api, path, confread, confwrite, **kwargs):
def autocheck_context_owner(api, pathread, pathwrite, confread, confwrite, **kwargs):
owner = api.owner.get()
assert owner == OWNER
def _check_owner(api, path, conf, kwargs, owner, permissive_owner):
isslave = api.unrestraint.option(path).option.isslave()
def _check_owner(api, pathread, conf, kwargs, owner, permissive_owner):
isslave = api.unrestraint.option(pathread).option.isslave()
if not isslave:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path).owner.get() == owner
assert api.forcepermissive.config(conf).option(path).owner.get() == owner
assert api.config(conf).option(pathread).owner.get() == owner
assert api.forcepermissive.config(conf).option(pathread).owner.get() == owner
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(conf).option(path).owner.get()")
assert api.forcepermissive.config(conf).option(path).owner.get() == permissive_owner
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
assert api.forcepermissive.config(conf).option(pathread).owner.get() == permissive_owner
else:
raises(PropertiesOptionError, "api.config(conf).option(path).owner.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path).owner.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.get()")
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(conf).option(path, 0).owner.get() == 'default'
assert api.forcepermissive.config(conf).option(path, 0).owner.get() == 'default'
assert api.config(conf).option(path, 1).owner.get() == owner
assert api.forcepermissive.config(conf).option(path, 1).owner.get() == owner
assert api.config(conf).option(pathread, 0).owner.get() == 'default'
assert api.forcepermissive.config(conf).option(pathread, 0).owner.get() == 'default'
assert api.config(conf).option(pathread, 1).owner.get() == owner
assert api.forcepermissive.config(conf).option(pathread, 1).owner.get() == owner
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.config(conf).option(path, 0).owner.get()")
raises(PropertiesOptionError, "api.config(conf).option(path, 1).owner.get()")
assert api.forcepermissive.config(conf).option(path, 0).owner.get() == 'default'
assert api.forcepermissive.config(conf).option(path, 1).owner.get() == permissive_owner
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).owner.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread, 1).owner.get()")
assert api.forcepermissive.config(conf).option(pathread, 0).owner.get() == 'default'
assert api.forcepermissive.config(conf).option(pathread, 1).owner.get() == permissive_owner
else:
raises(PropertiesOptionError, "api.config(conf).option(path, 0).owner.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path, 0).owner.get()")
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).owner.get()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 0).owner.get()")
@autocheck
def autocheck_owner_with_value(api, path, confread, confwrite, **kwargs):
def autocheck_owner_with_value(api, pathread, pathwrite, confread, confwrite, **kwargs):
"""value is now changed, check owner in this case
"""
_set_value(api, path, confwrite, **kwargs)
_check_owner(api, path, confwrite, kwargs, OWNER, OWNER)
_set_value(api, pathwrite, confwrite, **kwargs)
_check_owner(api, pathread, confwrite, kwargs, OWNER, OWNER)
if confread != confwrite:
_check_owner(api, path, confread, kwargs, owners.meta, owners.meta)
_check_owner(api, pathread, confread, kwargs, owners.meta, owners.meta)
@autocheck
def autocheck_default_owner_with_value(api, path, confread, confwrite, **kwargs):
isslave = api.unrestraint.option(path).option.isslave()
_set_value(api, path, confwrite, **kwargs)
def autocheck_default_owner_with_value(api, pathread, pathwrite, confread, confwrite, **kwargs):
isslave = api.unrestraint.option(pathread).option.isslave()
_set_value(api, pathwrite, confwrite, **kwargs)
# test if is default owner without permissive
if not isslave:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(confwrite).option(path).owner.isdefault() is False
assert api.config(confwrite).option(pathread).owner.isdefault() is False
if confwrite != confread:
assert api.config(confread).option(path).owner.isdefault() is False
assert api.config(confread).option(pathread).owner.isdefault() is False
else:
raises(PropertiesOptionError, "api.config(confwrite).option(path).owner.isdefault()")
raises(PropertiesOptionError, "api.config(confread).option(path).owner.isdefault()")
raises(PropertiesOptionError, "api.config(confwrite).option(pathread).owner.isdefault()")
raises(PropertiesOptionError, "api.config(confread).option(pathread).owner.isdefault()")
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
assert api.config(confwrite).option(path, 0).owner.isdefault() is True
assert api.config(confwrite).option(path, 1).owner.isdefault() is False
assert api.config(confwrite).option(pathread, 0).owner.isdefault() is True
assert api.config(confwrite).option(pathread, 1).owner.isdefault() is False
if confwrite != confread:
assert api.config(confread).option(path, 0).owner.isdefault() is True
assert api.config(confread).option(path, 1).owner.isdefault() is False
assert api.config(confread).option(pathread, 0).owner.isdefault() is True
assert api.config(confread).option(pathread, 1).owner.isdefault() is False
else:
raises(PropertiesOptionError, "api.config(confwrite).option(path, 0).owner.isdefault()")
raises(PropertiesOptionError, "api.config(confread).option(path, 0).owner.isdefault()")
raises(PropertiesOptionError, "api.config(confwrite).option(pathread, 0).owner.isdefault()")
raises(PropertiesOptionError, "api.config(confread).option(pathread, 0).owner.isdefault()")
@autocheck
def autocheck_default_owner_with_value_permissive(api, path, confread, confwrite, **kwargs):
def autocheck_default_owner_with_value_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
# check if is a isslave
isslave = api.unrestraint.option(path).option.isslave()
isslave = api.unrestraint.option(pathread).option.isslave()
_set_value(api, path, confwrite, **kwargs)
_set_value(api, pathwrite, confwrite, **kwargs)
def do(conf):
# test if is default owner with permissive
if not kwargs.get('propertyerror', False):
if not isslave:
assert api.forcepermissive.config(conf).option(path).owner.isdefault() is False
assert api.forcepermissive.config(conf).option(pathread).owner.isdefault() is False
else:
assert api.forcepermissive.config(conf).option(path, 0).owner.isdefault() is True
assert api.forcepermissive.config(conf).option(path, 1).owner.isdefault() is False
assert api.forcepermissive.config(conf).option(pathread, 0).owner.isdefault() is True
assert api.forcepermissive.config(conf).option(pathread, 1).owner.isdefault() is False
else:
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(path).owner.isdefault()")
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.isdefault()")
do(confwrite)
if confwrite != confread:
do(confread)
@autocheck
def autocheck_set_owner_no_value(api, path, confread, confwrite, **kwargs):
isslave = api.unrestraint.option(path).option.isslave()
def autocheck_set_owner_no_value(api, pathread, pathwrite, confread, confwrite, **kwargs):
isslave = api.unrestraint.option(pathread).option.isslave()
if not kwargs.get('propertyerror', False):
if not isslave:
raises(ConfigError, "api.forcepermissive.config(confwrite).option(path).owner.set('new_user')")
raises(ConfigError, "api.forcepermissive.config(confwrite).option(pathwrite).owner.set('new_user')")
else:
raises(ConfigError, "api.forcepermissive.option(path, 1).owner.set('new_user')")
raises(ConfigError, "api.forcepermissive.option(pathwrite, 1).owner.set('new_user')")
@autocheck
def autocheck_set_owner(api, path, confread, confwrite, **kwargs):
def autocheck_set_owner(api, pathread, pathwrite, confread, confwrite, **kwargs):
# test set owner without permissive
isslave = api.unrestraint.option(path).option.isslave()
isslave = api.unrestraint.option(pathread).option.isslave()
_set_value(api, path, confwrite, **kwargs)
_set_value(api, pathwrite, confwrite, **kwargs)
# set owner without permissive
if not isslave:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
api.config(confwrite).option(path).owner.set('new_user')
raises(ConfigError, "api.config(confwrite).option(path).owner.set('default')")
raises(ConfigError, "api.config(confwrite).option(path).owner.set('forced')")
raises(ConfigError, "api.config(confwrite).option(path).owner.set('meta')")
api.config(confwrite).option(pathwrite).owner.set('new_user')
raises(ConfigError, "api.config(confwrite).option(pathwrite).owner.set('default')")
raises(ConfigError, "api.config(confwrite).option(pathwrite).owner.set('forced')")
raises(ConfigError, "api.config(confwrite).option(pathwrite).owner.set('meta')")
else:
raises(PropertiesOptionError, "api.config(confwrite).option(path).owner.set('new_user')")
raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).owner.set('new_user')")
else:
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
api.option(path, 1).owner.set('new_user')
api.option(pathwrite, 1).owner.set('new_user')
else:
raises(PropertiesOptionError, "api.option(path, 1).owner.set('new_user')")
raises(PropertiesOptionError, "api.option(pathwrite, 1).owner.set('new_user')")
_check_owner(api, path, confwrite, kwargs, owners.new_user, OWNER)
_check_owner(api, pathread, confwrite, kwargs, owners.new_user, OWNER)
if confwrite != confread:
_check_owner(api, path, confread, kwargs, owners.meta, owners.meta)
_check_owner(api, pathread, confread, kwargs, owners.meta, owners.meta)
@autocheck
def autocheck_set_owner_permissive(api, path, confread, confwrite, **kwargs):
isslave = api.unrestraint.option(path).option.isslave()
def autocheck_set_owner_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
isslave = api.unrestraint.option(pathread).option.isslave()
_set_value(api, path, confwrite, **kwargs)
_set_value(api, pathwrite, confwrite, **kwargs)
# set owner with permissive
if not kwargs.get('propertyerror', False):
if not isslave:
api.forcepermissive.config(confwrite).option(path).owner.set('new_user1')
api.forcepermissive.config(confwrite).option(pathwrite).owner.set('new_user1')
else:
api.forcepermissive.option(path, 1).owner.set('new_user1')
api.forcepermissive.option(pathwrite, 1).owner.set('new_user1')
else:
if not isslave:
raises(PropertiesOptionError,
"api.forcepermissive.config(confwrite).option(path).owner.set('new_user1')")
"api.forcepermissive.config(confwrite).option(pathwrite).owner.set('new_user1')")
else:
raises(PropertiesOptionError,
"api.forcepermissive.option(path, 1).owner.set('new_user1')")
"api.forcepermissive.option(pathwrite, 1).owner.set('new_user1')")
_check_owner(api, path, confwrite, kwargs, 'new_user1', 'new_user1')
_check_owner(api, pathread, confwrite, kwargs, 'new_user1', 'new_user1')
if confwrite != confread:
_check_owner(api, path, confread, kwargs, owners.meta, owners.meta)
_check_owner(api, pathread, confread, kwargs, owners.meta, owners.meta)
@autocheck
def autocheck_option(api, path, confread, confwrite, **kwargs):
expected_name = path.split('.')[-1]
def autocheck_option(api, pathread, pathwrite, confread, confwrite, **kwargs):
expected_name = pathread.split('.')[-1]
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
current_name = api.option(path).option.getname()
assert current_name == api.forcepermissive.option(path).option.getname()
assert current_name == api.unrestraint.option(path).option.getname()
doc = api.option(path).option.getdoc()
assert doc == api.forcepermissive.option(path).option.getdoc()
assert doc == api.unrestraint.option(path).option.getdoc()
current_name = api.option(pathread).option.getname()
assert current_name == api.forcepermissive.option(pathread).option.getname()
assert current_name == api.unrestraint.option(pathread).option.getname()
doc = api.option(pathread).option.getdoc()
assert doc == api.forcepermissive.option(pathread).option.getdoc()
assert doc == api.unrestraint.option(pathread).option.getdoc()
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.option(path).option.getname()")
current_name = api.forcepermissive.option(path).option.getname()
assert current_name == api.unrestraint.option(path).option.getname()
raises(PropertiesOptionError, "api.option(path).option.getdoc()")
doc = api.forcepermissive.option(path).option.getdoc()
assert doc == api.unrestraint.option(path).option.getdoc()
raises(PropertiesOptionError, "api.option(pathread).option.getname()")
current_name = api.forcepermissive.option(pathread).option.getname()
assert current_name == api.unrestraint.option(pathread).option.getname()
raises(PropertiesOptionError, "api.option(pathread).option.getdoc()")
doc = api.forcepermissive.option(pathread).option.getdoc()
assert doc == api.unrestraint.option(pathread).option.getdoc()
else:
raises(PropertiesOptionError, "api.option(path).option.getname()")
raises(PropertiesOptionError, "api.forcepermissive.option(path).option.getname()")
current_name = api.unrestraint.option(path).option.getname()
raises(PropertiesOptionError, "api.option(path).option.getdoc()")
raises(PropertiesOptionError, "api.forcepermissive.option(path).option.getdoc()")
doc = api.unrestraint.option(path).option.getdoc()
raises(PropertiesOptionError, "api.option(pathread).option.getname()")
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.getname()")
current_name = api.unrestraint.option(pathread).option.getname()
raises(PropertiesOptionError, "api.option(pathread).option.getdoc()")
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.getdoc()")
doc = api.unrestraint.option(pathread).option.getdoc()
assert current_name == expected_name
if expected_name.endswith('val1') or expected_name.endswith('val2'):
expected_name = expected_name[:-4]
assert doc == "{}'s option".format(expected_name)
if kwargs['symlink']:
assert doc == "{}'s option link".format(expected_name)
else:
assert doc == "{}'s option".format(expected_name)
@autocheck
def autocheck_permissive(api, path, confread, confwrite, **kwargs):
def autocheck_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
"""test permissive for hidden and disabled value
"""
# no permissive before
assert api.unrestraint.config(confread).option(path).permissive.get() == frozenset()
assert api.unrestraint.config(confread).option(pathread).permissive.get() == frozenset()
if kwargs.get('permissive_od', False):
assert api.unrestraint.config(confread).option(path.rsplit('.', 1)[0]).permissive.get() == frozenset()
assert api.unrestraint.config(confread).option(pathread.rsplit('.', 1)[0]).permissive.get() == frozenset()
# cannot access to hidden value without forcepermissive
# and to disabled value (with forcepermissive too)
#
# with meta confread == confwrite
_autocheck_default_value(api, path, confread, **kwargs)
_autocheck_default_value(api, pathread, confread, **kwargs)
# set permissive
api.unrestraint.config(confwrite).option(path).permissive.set(frozenset(['disabled']))
api.unrestraint.config(confwrite).option(pathwrite).permissive.set(frozenset(['disabled']))
callback = kwargs['callback']
if callback:
if path.endswith('val1') or path.endswith('val2'):
call_path = path[:-4] + 'call' + path[-4:]
if pathread.endswith('val1') or pathread.endswith('val2'):
call_path = pathread[:-4] + 'call' + pathread[-4:]
else:
call_path = path + 'call'
call_path = pathread + 'call'
api.unrestraint.config(confwrite).option(call_path).permissive.set(frozenset(['disabled']))
# have permissive
assert api.unrestraint.config(confwrite).option(path).permissive.get() == frozenset(['disabled'])
assert api.unrestraint.config(confwrite).option(pathread).permissive.get() == frozenset(['disabled'])
if confwrite != confread:
assert api.unrestraint.config(confread).option(path).permissive.get() == frozenset(['disabled'])
assert api.unrestraint.config(confread).option(pathread).permissive.get() == frozenset(['disabled'])
# can access to disabled value
ckwargs = copy(kwargs)
ckwargs['propertyerror'] = False
_autocheck_default_value(api, path, confread, **ckwargs)
_autocheck_default_value(api, pathread, confread, **ckwargs)
api.unrestraint.config(confwrite).option(path).permissive.set(frozenset(['disabled', 'hidden']))
api.unrestraint.config(confwrite).option(pathwrite).permissive.set(frozenset(['disabled', 'hidden']))
if kwargs['callback']:
api.unrestraint.config(confwrite).option(call_path).permissive.set(frozenset(['disabled', 'hidden']))
# can access to all value except when optiondescript have hidden
if not ckwargs.get('permissive_od', False):
ckwargs['permissive'] = False
_autocheck_default_value(api, path, confread, **ckwargs)
_autocheck_default_value(api, pathread, confread, **ckwargs)
if confread != confwrite:
_autocheck_default_value(api, path, confwrite, **ckwargs)
_autocheck_default_value(api, pathread, confwrite, **ckwargs)
if ckwargs.get('permissive_od', False):
# set permissive to OptionDescription
api.unrestraint.config(confwrite).option(path.rsplit('.', 1)[0]).permissive.set(frozenset(['disabled',
api.unrestraint.config(confwrite).option(pathwrite.rsplit('.', 1)[0]).permissive.set(frozenset(['disabled',
'hidden']))
ckwargs['permissive'] = False
_autocheck_default_value(api, path, confread, **ckwargs)
_autocheck_default_value(api, pathread, confread, **ckwargs)
if confread != confwrite:
_autocheck_default_value(api, path, confwrite, **ckwargs)
_autocheck_default_value(api, pathread, confwrite, **ckwargs)
# only hidden
api.unrestraint.config(confwrite).option(path).permissive.set(frozenset(['hidden']))
api.unrestraint.config(confwrite).option(pathwrite).permissive.set(frozenset(['hidden']))
if callback:
api.unrestraint.config(confwrite).option(call_path).permissive.set(frozenset(['hidden']))
if ckwargs.get('permissive_od', False):
_autocheck_default_value(api, path, confread, **ckwargs)
_autocheck_default_value(api, pathread, confread, **ckwargs)
if confread != confwrite:
_autocheck_default_value(api, path, confwrite, **ckwargs)
api.unrestraint.config(confwrite).option(path.rsplit('.', 1)[0]).permissive.set(frozenset(['hidden']))
_autocheck_default_value(api, pathread, confwrite, **ckwargs)
api.unrestraint.config(confwrite).option(pathwrite.rsplit('.', 1)[0]).permissive.set(frozenset(['hidden']))
ckwargs = copy(kwargs)
ckwargs['permissive'] = False
_autocheck_default_value(api, path, confread, **ckwargs)
_autocheck_default_value(api, pathread, confread, **ckwargs)
if confread != confwrite:
_autocheck_default_value(api, path, confwrite, **ckwargs)
_autocheck_default_value(api, pathread, confwrite, **ckwargs)
# no permissive
api.unrestraint.config(confwrite).option(path).permissive.set(frozenset())
api.unrestraint.config(confwrite).option(pathwrite).permissive.set(frozenset())
if callback:
api.unrestraint.config(confwrite).option(call_path).permissive.set(frozenset())
if ckwargs.get('permissive_od', False):
_autocheck_default_value(api, path, confread, **ckwargs)
_autocheck_default_value(api, pathread, confread, **ckwargs)
if confread != confwrite:
_autocheck_default_value(api, path, confwrite, **ckwargs)
api.unrestraint.config(confwrite).option(path.rsplit('.', 1)[0]).permissive.set(frozenset())
_autocheck_default_value(api, path, confread, **kwargs)
_autocheck_default_value(api, pathread, confwrite, **ckwargs)
api.unrestraint.config(confwrite).option(pathwrite.rsplit('.', 1)[0]).permissive.set(frozenset())
_autocheck_default_value(api, pathread, confread, **kwargs)
if confread != confwrite:
_autocheck_default_value(api, path, confwrite, **kwargs)
_autocheck_default_value(api, pathread, confwrite, **kwargs)
@autocheck
def autocheck_option_get(api, path, confread, confwrite, **kwargs):
if '.' in path:
name = path.rsplit('.', 1)[1]
def autocheck_option_get(api, pathread, pathwrite, confread, confwrite, **kwargs):
if '.' in pathread:
name = pathread.rsplit('.', 1)[1]
else:
name = path
assert api.option.get(path).impl_getname() == name
name = pathread
assert api.option.get(pathread).impl_getname() == name
@autocheck
def autocheck_find(api, path, confread, confwrite, **kwargs):
def autocheck_find(api, pathread, pathwrite, confread, confwrite, **kwargs):
def _getoption(opt):
if opt.impl_is_dynsymlinkoption():
opt = opt.impl_getopt()
@ -1101,11 +1102,11 @@ def autocheck_find(api, path, confread, confwrite, **kwargs):
nopts.append(_getoption(opt))
return nopts
if '.' in path:
name = path.rsplit('.', 1)[1]
if '.' in pathread:
name = pathread.rsplit('.', 1)[1]
else:
name = path
option = _getoption(api.option.get(path))
name = pathread
option = _getoption(api.option.get(pathread))
def do(conf):
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
@ -1119,14 +1120,14 @@ def autocheck_find(api, path, confread, confwrite, **kwargs):
raises(AttributeError, "api.forcepermissive.config(conf).option.find_first(name)")
assert option == _getoption(api.unrestraint.config(conf).option.find_first(name))
assert [option] == _getoptions(api.unrestraint.config(conf).option.find(name))
assert path == api.unrestraint.config(conf).option.find_first(name, 'path')
assert [path] == api.unrestraint.config(conf).option.find(name, 'path')
assert pathread == api.unrestraint.config(conf).option.find_first(name, 'path')
assert [pathread] == api.unrestraint.config(conf).option.find(name, 'path')
do(confread)
if confread != confwrite:
do(confwrite)
def check_all(cfg, paths, path, meta, multi, default, default_multi, require, consistency, callback, weakrefs, **kwargs):
def check_all(cfg, paths, path, meta, multi, default, default_multi, require, consistency, callback, symlink, weakrefs, **kwargs):
def _build_make_dict():
dico = {}
dico_value = {}
@ -1170,10 +1171,16 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
dyns.append(no_propertieserror or allow_req)
if not is_dyn and (no_propertieserror or allow_req):
dico[cpath] = default_value
if symlink:
dico[cpath + 'link'] = default_value
if path == cpath:
dico_value[cpath] = value
if symlink:
dico_value[cpath + 'link'] = value
else:
dico_value[cpath] = default_value
if symlink:
dico_value[cpath + 'link'] = default_value
has_value = True
isslave = False
@ -1186,10 +1193,16 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
for cpath in list(paths.keys())[len(dyns):]:
if dyns[idx]:
dico[cpath] = default_value
if symlink:
dico[cpath + 'link'] = default_value
if path == cpath:
dico_value[cpath] = value
if symlink:
dico_value[cpath + 'link'] = value
else:
dico_value[cpath] = default_value
if symlink:
dico_value[cpath + 'link'] = default_value
idx += 1
if idx == len(dyns):
idx = 0
@ -1197,9 +1210,15 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
if not req:
dico['extraoptrequire'] = None
dico_value['extraoptrequire'] = None
if symlink:
dico['extraoptrequirelink'] = None
dico_value['extraoptrequirelink'] = None
else:
dico['extraoptrequire'] = 'value'
dico_value['extraoptrequire'] = 'value'
if symlink:
dico['extraoptrequirelink'] = 'value'
dico_value['extraoptrequirelink'] = 'value'
if consistency and has_value:
cpath = list(dico.keys())[0]
if "." in cpath:
@ -1253,16 +1272,24 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
len_master = len(dico[cpath])
if second_path in dico:
dico[second_path] = [dvalue] * len_master
if symlink:
dico[second_path + 'link'] = [dvalue] * len_master
if third_path in dico:
dico[third_path] = [dvalue] * len_master
if symlink:
dico[third_path + 'link'] = [dvalue] * len_master
if cons_path in dico:
dico[cons_path] = [dvalue] * len_master
#
len_master = len(dico_value[cpath])
if second_path in dico_value:
dico_value[second_path] = [dvalue] * len_master
if symlink:
dico_value[second_path + 'link'] = [dvalue] * len_master
if third_path in dico_value:
dico_value[third_path] = [dvalue] * len_master
if symlink:
dico_value[third_path + 'link'] = [dvalue] * len_master
if cons_path in dico_value:
dico_value[cons_path] = [dvalue] * len_master
return is_dyn, dico, dico_value
@ -1293,6 +1320,7 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
for req in requires:
is_dyn, kwargs['make_dict'], kwargs['make_dict_value'] = _build_make_dict()
kwargs['callback'] = callback
kwargs['symlink'] = symlink
for func in autocheck_registers:
cfg_name = 'conftest' + str(idx)
idx += 1
@ -1319,10 +1347,16 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
api.option(master_path).value.set(value)
ckwargs['make_dict'][master_path] = value
ckwargs['make_dict_value'][master_path] = value
if symlink:
ckwargs['make_dict'][master_path + 'link'] = value
ckwargs['make_dict_value'][master_path + 'link'] = value
if master_path_2:
api.option(master_path_2).value.set(value)
ckwargs['make_dict'][master_path_2] = value
ckwargs['make_dict_value'][master_path_2] = value
if symlink:
ckwargs['make_dict'][master_path_2 + 'link'] = value
ckwargs['make_dict_value'][master_path_2 + 'link'] = value
if default_multi:
if multi is not submulti:
dvalue = SECOND_VALUE
@ -1341,18 +1375,31 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
if npath in ckwargs['make_dict']:
ckwargs['make_dict'][npath] = [dvalue] * len(value)
ckwargs['make_dict_value'][npath] = [dvalue] * len(value)
if symlink:
ckwargs['make_dict'][npath + 'link'] = [dvalue] * len(value)
ckwargs['make_dict_value'][npath + 'link'] = [dvalue] * len(value)
if path == npath:
ckwargs['make_dict_value'][npath][-1] = ckwargs['make_dict_value'][master_path][-1]
if symlink:
ckwargs['make_dict_value'][npath + 'link'][-1] = ckwargs['make_dict_value'][master_path][-1]
npath = ldirname + '.third' + suffix
if npath in ckwargs['make_dict']:
ckwargs['make_dict'][npath] = [dvalue] * len(value)
ckwargs['make_dict_value'][npath] = [dvalue] * len(value)
if symlink:
ckwargs['make_dict'][npath + 'link'] = [dvalue] * len(value)
ckwargs['make_dict_value'][npath + 'link'] = [dvalue] * len(value)
if path == npath:
ckwargs['make_dict_value'][npath][-1] = ckwargs['make_dict_value'][master_path][-1]
if symlink:
ckwargs['make_dict_value'][npath + 'link'][-1] = ckwargs['make_dict_value'][master_path][-1]
npath = ldirname + '.extraoptconsistency' + suffix
if npath in ckwargs['make_dict']:
ckwargs['make_dict'][npath] = [dvalue] * len(value)
ckwargs['make_dict_value'][npath] = [dvalue] * len(value)
if symlink:
ckwargs['make_dict'][npath + 'link'] = [dvalue] * len(value)
ckwargs['make_dict_value'][npath + 'link'] = [dvalue] * len(value)
if not is_dyn:
do('')
else:
@ -1363,7 +1410,10 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
#FIXME devrait etre dans la config ca ...
api.read_write()
if req:
api.option('extraoptrequire').value.set('value')
name = 'extraoptrequire'
if symlink:
name += 'link'
api.option(name).value.set('value')
if 'permissive' in ckwargs and not 'permissive_od' in ckwargs or \
'propertyerror' in ckwargs and not 'propertyerror_od' in ckwargs:
for to_del in ['permissive', 'propertyerror', 'extra_properties']:
@ -1371,8 +1421,13 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
del ckwargs[to_del]
if DISPLAY:
print(u' {} {}'.format(ICON, func.__name__))
pathread = path
if symlink:
pathwrite = path + 'link'
else:
pathwrite = path
try:
func(api, path, confread, confwrite, **ckwargs)
func(api, pathread, pathwrite, confread, confwrite, **ckwargs)
except Exception as err:
msg = u'error in function {} for {}'.format(func.__name__, path)
if multi is True:
@ -1383,6 +1438,8 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
msg += u' with default value'
if callback is True:
msg += u' (callback)'
if symlink is True:
msg += u' (symlink)'
print(u'{}: {}'.format(msg, ckwargs))
raise err
del api
@ -1396,7 +1453,7 @@ def check_deref(weakrefs):
assert wrf() is None
def make_conf(options, meta, multi, default, default_multi, require, consistency, callback):
def make_conf(options, meta, multi, default, default_multi, require, consistency, callback, symlink):
weakrefs = []
dyn = []
goptions = []
@ -1405,6 +1462,8 @@ def make_conf(options, meta, multi, default, default_multi, require, consistency
option_properties = []
option_requires = []
isslave = False
if in_master and symlink:
return None, None, None
if option_infos is not None:
for prop in PROPERTIES:
if option_infos.get(prop, False) is True:
@ -1443,7 +1502,7 @@ def make_conf(options, meta, multi, default, default_multi, require, consistency
else:
kwargs['default'] = value
elif callback:
return None, None
return None, None, None
if default_multi and path is not 'extraoptrequire':
if multi is not submulti:
value = SECOND_VALUE
@ -1458,14 +1517,24 @@ def make_conf(options, meta, multi, default, default_multi, require, consistency
kwargs['callback_params'] = {'': ((objcall, False),)}
else:
objcall = None
if symlink and not path.endswith('extraoptconsistency'):
sobj = tiramisu_option(args[0] + 'link', args[1] + ' link', **kwargs)
kwargs = {}
args[1] = sobj
tiramisu_option = SymLinkOption
else:
sobj = None
obj = tiramisu_option(*args, **kwargs)
if not 'extraopt' in path and consistency:
if require:
gopt = goptions[1]
if symlink:
gopt = goptions[2]
else:
gopt = goptions[1]
else:
gopt = goptions[0]
obj.impl_add_consistency('not_equal', gopt, warnings_only=True)
return obj, objcall
return obj, objcall, sobj
def make_optiondescriptions(path, collected):
infos = collected.get('properties', {})
@ -1481,6 +1550,8 @@ def make_conf(options, meta, multi, default, default_multi, require, consistency
return
optiondescription = MasterSlaves
if infos.get('dyn', False) is True:
if symlink:
return
optiondescription = DynOptionDescription
kwargs['callback'] = return_list
dyn.append(path)
@ -1535,12 +1606,14 @@ def make_conf(options, meta, multi, default, default_multi, require, consistency
oddescr = collect_options
in_master = oddescr.get(name_od, {}).get('properties', {}).get('master')
master = in_master and path.endswith('first')
obj, objcall = make_option(option_name, option.get(option_name), in_master, master)
obj, objcall, sobj = make_option(option_name, option.get(option_name), in_master, master)
if obj is None:
return None, None, None
weakrefs.append(weakref.ref(obj))
if callback:
weakrefs.append(weakref.ref(objcall))
if sobj is not None:
weakrefs.append(weakref.ref(sobj))
if '.' in path:
if master:
local_collect_options.setdefault('options', []).insert(0, obj)
@ -1552,6 +1625,9 @@ def make_conf(options, meta, multi, default, default_multi, require, consistency
if callback:
local_collect_options.setdefault('options', []).append(objcall)
goptions.append(objcall)
if sobj is not None:
local_collect_options.setdefault('options', []).append(sobj)
goptions.append(sobj)
rootod = make_optiondescriptions('root', collect_options)
if rootod is None:
@ -1659,35 +1735,38 @@ def test_options(paths):
for consistency in (False, True):
for require in (False, True):
for default_multi in (False, True):
if callback and default_multi:
continue
for default in (False, True):
for multi in (False, True, submulti):
if multi is submulti and default:
continue
if multi is submulti and consistency:
continue
if multi is False and default_multi:
continue
cfg, weakrefs, dyn = make_conf(paths, meta, multi, default, default_multi, require, consistency, callback)
if cfg is None:
continue
if dyn:
cnt = 0
idx = 0
for index, lpath in enumerate(lpaths):
if paths[lpath]:
cnt += 1
else:
check_all(cfg, paths, lpaths[index], meta, multi, default,
default_multi, require, consistency, callback, weakrefs, **get_kwargs(lpaths[idx]))
idx += 1
if idx == cnt:
idx = 0
else:
for lpath in lpaths:
check_all(cfg, paths, lpath, meta, multi, default,
default_multi, require, consistency, callback, weakrefs, **get_kwargs(lpath))
del cfg
check_deref(weakrefs)
for symlink in (False, True):
if callback and default_multi:
continue
for default in (False, True):
for multi in (False, True, submulti):
if multi is submulti and default:
continue
if multi is submulti and consistency:
continue
if multi is False and default_multi:
continue
cfg, weakrefs, dyn = make_conf(paths, meta, multi, default, default_multi, require, consistency, callback, symlink)
if cfg is None:
continue
if dyn:
cnt = 0
idx = 0
for index, lpath in enumerate(lpaths):
if paths[lpath]:
cnt += 1
else:
check_all(cfg, paths, lpaths[index], meta, multi, default,
default_multi, require, consistency, callback, symlink,
weakrefs, **get_kwargs(lpaths[idx]))
idx += 1
if idx == cnt:
idx = 0
else:
for lpath in lpaths:
check_all(cfg, paths, lpath, meta, multi, default,
default_multi, require, consistency, callback, symlink,
weakrefs, **get_kwargs(lpath))
del cfg
check_deref(weakrefs)
display_count()

View File

@ -224,7 +224,8 @@ class TiramisuOptionOwner(CommonTiramisuOption):
except AttributeError:
owners.addowner(owner)
obj_owner = getattr(owners, owner)
self.values.setowner(self.path,
self.values.setowner(self.opt,
self.path,
obj_owner,
self.index)
@ -268,7 +269,8 @@ class TiramisuOptionProperty(CommonTiramisuOption):
def reset(self):
"""reset all personalised properties
"""
self.settings.reset(_path=self.path)
self.settings.reset(opt=self.opt,
path=self.path)
class TiramisuOptionPermissive(CommonTiramisuOption):
@ -296,7 +298,8 @@ class TiramisuOptionPermissive(CommonTiramisuOption):
def get(self):
"""get permissive value for a specified path"""
return self.settings.getpermissive(self.path)
return self.settings.getpermissive(self.opt,
self.path)
def set(self, permissive):
self.settings.setpermissive(self.opt,
@ -514,6 +517,18 @@ class TiramisuOptionDispatcher(TiramisuContextOption):
index=index)
if index is not None and not opt.impl_is_master_slaves('slave'):
raise APIError('index must be set only with a slave option')
if opt.impl_is_symlinkoption():
true_opt = opt.impl_getopt()
true_path = true_opt.impl_getpath(self.config)
self.config.unwrap_from_path(true_path,
setting_properties=s_properties,
validate=validate,
validate_properties=validate,
force_permissive=self.force_permissive,
index=index)
else:
true_opt = None
true_path = None
return TiramisuOption(opt,
path,
index,

View File

@ -327,9 +327,8 @@ class SubConfig(object):
self)
if isinstance(child, (OptionDescription, SynDynOptionDescription)):
raise TypeError(_("can't assign to an OptionDescription")) # pragma: optional cover
elif child.impl_is_symlinkoption() and \
not isinstance(child, DynSymLinkOption): # pragma: no dynoptiondescription cover
raise TypeError(_("can't assign to a SymlinkOption"))
elif child.impl_is_symlinkoption():
raise TypeError(_("can't assign to a SymLinkOption"))
else:
self.cfgimpl_get_description().impl_validate_value(child,
value,
@ -360,9 +359,8 @@ class SubConfig(object):
self)
if isinstance(child, (OptionDescription, SynDynOptionDescription)):
raise TypeError(_("can't delete an OptionDescription")) # pragma: optional cover
elif child.impl_is_symlinkoption() and \
not isinstance(child, DynSymLinkOption): # pragma: no dynoptiondescription cover
raise TypeError(_("can't delete a SymlinkOption"))
elif child.impl_is_symlinkoption():
raise TypeError(_("can't delete a SymLinkOption"))
subpath = self._get_subpath(name)
values = self.cfgimpl_get_values()
if index is not None:
@ -420,11 +418,7 @@ class SubConfig(object):
option = self.cfgimpl_get_description().impl_getchild(name,
setting_properties,
self)
if option.impl_is_symlinkoption() and isinstance(option, DynSymLinkOption):
# FIXME peuvent-il vraiment etre le 2 ?
# si non supprimer tout ces tests inutiles
raise Exception('oui ca existe ...')
if option.impl_is_symlinkoption() and not isinstance(option, DynSymLinkOption):
if option.impl_is_symlinkoption():
if returns_option is True:
return option
path = context.cfgimpl_get_description().impl_get_path_by_opt(option.impl_getopt())
@ -843,21 +837,31 @@ class _CommonConfig(SubConfig):
if not validate_properties:
return option
else:
if index is None and option.impl_is_master_slaves('slave'):
subpath = self._get_subpath(path)
self.cfgimpl_get_settings().validate_properties(option,
if option.impl_is_symlinkoption():
true_option = option.impl_getopt()
true_path = true_option.impl_getpath(self._cfgimpl_get_context())
self, path = self.cfgimpl_get_context().cfgimpl_get_home_by_path(true_path,
force_permissive=force_permissive,
validate_properties=validate_properties,
setting_properties=setting_properties)
else:
true_option = option
true_path = path
if index is None and true_option.impl_is_master_slaves('slave'):
subpath = self._get_subpath(true_path)
self.cfgimpl_get_settings().validate_properties(true_option,
subpath,
setting_properties,
force_permissive=force_permissive)
return option
else:
return self.getattr(path,
validate=validate,
force_permissive=force_permissive,
index=index,
setting_properties=setting_properties,
validate_properties=validate_properties,
returns_option=True)
self.getattr(path,
validate=validate,
force_permissive=force_permissive,
index=index,
setting_properties=setting_properties,
validate_properties=validate_properties,
returns_option=True)
return option
def cfgimpl_get_path(self, dyn=True):
return None

View File

@ -525,7 +525,7 @@ class Option(OnlyOption):
if opt.impl_is_submulti():
raise ConfigError(_('cannot add consistency with submulti option'))
if not isinstance(opt, Option):
raise ConfigError(_('consistency must be set with an option'))
raise ConfigError(_('consistency must be set with an option, not {}').format(opt))
if opt._is_subdyn():
if dynod is None:
raise ConfigError(_('almost one option in consistency is '

View File

@ -73,9 +73,6 @@ class SynDynOptionDescription(object):
subpath += '.'
return subpath + self.impl_getname()
def impl_getopt(self):
return self._opt
def getmaster(self):
master = self._opt.getmaster()
return DynSymLinkOption(master,

View File

@ -291,6 +291,9 @@ class Settings(object):
apply_requires=True):
"""
"""
if opt.impl_is_symlinkoption():
opt = opt.impl_getopt()
path = opt.impl_getpath(self._getcontext())
is_cached = False
if apply_requires:
@ -325,7 +328,8 @@ class Settings(object):
props = copy(props)
props |= requires
props -= self.getpermissive(path)
props -= self.getpermissive(opt,
path)
if apply_requires and 'cache' in setting_properties:
if 'expire' in setting_properties:
ntime = ntime + expires_time
@ -336,14 +340,19 @@ class Settings(object):
return props
def get_context_permissive(self):
return self.getpermissive(None)
return self.getpermissive(None, None)
def getpermissive(self,
opt,
path):
if opt and opt.impl_is_symlinkoption():
opt = opt.impl_getopt()
path = opt.impl_getpath(self._getcontext())
meta = self._getcontext().cfgimpl_get_meta()
if meta is None:
return self._pp_.getpermissive(path)
return meta.cfgimpl_get_settings().getpermissive(path)
return meta.cfgimpl_get_settings().getpermissive(opt,
path)
def apply_requires(self,
opt,
@ -503,6 +512,9 @@ class Settings(object):
"""
if self._getcontext().cfgimpl_get_meta() is not None:
raise ConfigError(_('cannot change property with metaconfig'))
if opt and opt.impl_is_symlinkoption():
raise TypeError(_("can't assign properties to the SymLinkOption \"{}\""
"").format(opt.impl_get_display_name()))
forbidden_properties = forbidden_set_properties & properties
if forbidden_properties:
raise ConfigError(_('cannot add those properties: {0}').format(
@ -535,6 +547,9 @@ class Settings(object):
raise ConfigError(_('cannot change permissive with metaconfig'))
if not isinstance(permissives, frozenset):
raise TypeError(_('permissive must be a frozenset'))
if opt and opt.impl_is_symlinkoption():
raise TypeError(_("can't assign permissive to the SymLinkOption \"{}\""
"").format(opt.impl_get_display_name()))
forbidden_permissives = forbidden_set_permissives & permissives
if forbidden_permissives:
raise ConfigError(_('cannot add those permissives: {0}').format(
@ -548,21 +563,24 @@ class Settings(object):
def reset(self,
opt=None,
_path=None,
path=None,
all_properties=False):
if self._getcontext().cfgimpl_get_meta() is not None:
raise ConfigError(_('cannot change property with metaconfig'))
if all_properties and (_path or opt): # pragma: optional cover
if opt and opt.impl_is_symlinkoption():
raise TypeError(_("can't reset properties to the SymLinkOption \"{}\""
"").format(opt.impl_get_display_name()))
if all_properties and (path or opt): # pragma: optional cover
raise ValueError(_('opt and all_properties must not be set '
'together in reset'))
if all_properties:
self._p_.reset_all_properties()
else:
if opt is not None and _path is None:
_path = opt.impl_getpath(self._getcontext())
self._p_.delproperties(_path)
if opt is not None and path is None:
path = opt.impl_getpath(self._getcontext())
self._p_.delproperties(path)
self._getcontext().cfgimpl_reset_cache(opt=opt,
path=_path)
path=path)
#____________________________________________________________
# validate properties

View File

@ -18,6 +18,9 @@
from copy import copy
from ..util import Cache
DEBUG = False
#DEBUG = True
class Properties(Cache):
__slots__ = ('_properties',)
@ -31,15 +34,24 @@ class Properties(Cache):
# properties
def setproperties(self, path, properties):
if DEBUG:
print('setproperties', path, properties)
self._properties[path] = properties
def getproperties(self, path, default_properties):
return self._properties.get(path, frozenset(default_properties))
ret = self._properties.get(path, frozenset(default_properties))
if DEBUG:
print('getproperties', path, ret)
return ret
def reset_all_properties(self):
if DEBUG:
print('reset_all_properties')
self._properties.clear()
def delproperties(self, path):
if DEBUG:
print('delproperties', path)
if path in self._properties:
del(self._properties[path])
@ -62,6 +74,8 @@ class Permissives(Cache):
super(Permissives, self).__init__(storage)
def setpermissive(self, path, permissive):
if DEBUG:
print('setpermissive', path, permissive)
if not permissive:
if path in self._permissives:
del self._permissives[path]
@ -69,7 +83,10 @@ class Permissives(Cache):
self._permissives[path] = permissive
def getpermissive(self, path=None):
return self._permissives.get(path, frozenset())
ret = self._permissives.get(path, frozenset())
if DEBUG:
print('getpermissive', path, ret)
return ret
def get_modified_permissives(self):
"""return all modified permissives in a dictionary

View File

@ -20,8 +20,8 @@ from ...setting import undefined
from ...i18n import _
DEBUG = True
DEBUG = False
#DEBUG = True
class Values(Cache):

View File

@ -519,9 +519,9 @@ class Values(object):
was present
:returns: a `setting.owners.Owner` object
"""
if opt.impl_is_symlinkoption() and \
not isinstance(opt, DynSymLinkOption):
if opt.impl_is_symlinkoption():
opt = opt.impl_getopt()
path = opt.impl_getpath(self._getcontext())
return self._getowner(opt,
path,
setting_properties,
@ -539,14 +539,11 @@ class Values(object):
index=None):
"""get owner of an option
"""
#FIXME: validate_meta ne marche que si == False ou undefined !
if validate_meta is not False and validate_meta is not undefined:
raise Exception('poeut')
#if not isinstance(opt, Option) and not isinstance(opt,
# DynSymLinkOption):
# raise ConfigError(_('owner only avalaible for an option'))
#FIXME pas defaut fait ??
context = self._getcontext()
if opt.impl_is_symlinkoption():
opt = opt.impl_getopt()
path = opt.impl_getpath(context)
#FIXME pas deja fait ??
if self_properties is undefined:
self_properties = context.cfgimpl_get_settings().getproperties(opt,
path,
@ -576,6 +573,7 @@ class Values(object):
return owner
def setowner(self,
opt,
path,
owner,
index=None):
@ -585,6 +583,9 @@ class Values(object):
:param opt: the `option.Option` object
:param owner: a valid owner, that is a `setting.owners.Owner` object
"""
if opt.impl_is_symlinkoption():
raise TypeError(_("can't set owner for the SymLinkOption \"{}\""
"").format(opt.impl_get_display_name()))
if not isinstance(owner, owners.Owner):
raise TypeError(_("invalid owner {0}").format(str(owner)))
@ -781,8 +782,7 @@ class Values(object):
for path in _mandatory_warnings(opt, currpath + [name]):
yield path
else:
if opt.impl_is_symlinkoption() and \
not isinstance(opt, DynSymLinkOption):
if opt.impl_is_symlinkoption():
continue
self_properties = settings.getproperties(opt,
path,