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