permissive only if needed + global properties are in metaconfig
This commit is contained in:
@ -26,9 +26,8 @@ def make_description():
|
||||
od2 = OptionDescription('od2', '', [od1])
|
||||
conf1 = Config(od2, name='conf1')
|
||||
conf2 = Config(od2, name='conf2')
|
||||
conf1.read_write()
|
||||
conf2.read_write()
|
||||
meta = MetaConfig([conf1, conf2], name='meta')
|
||||
meta.read_write()
|
||||
meta.cfgimpl_get_settings().setowner(owners.meta)
|
||||
return meta
|
||||
|
||||
@ -111,7 +110,7 @@ def test_find():
|
||||
assert [i2] == meta.find(byname='i2')
|
||||
assert i2 == meta.find_first(byname='i2')
|
||||
assert meta.make_dict() == {'od1.i4': 2, 'od1.i1': None, 'od1.i3': None,
|
||||
'od1.i2': 1, 'od1.i5': [2], 'od1.i6': None}
|
||||
'od1.i2': 1, 'od1.i5': [2]}
|
||||
|
||||
|
||||
def test_group_error():
|
||||
@ -157,6 +156,7 @@ def test_meta_meta_set():
|
||||
meta1 = make_description()
|
||||
meta2 = MetaConfig([meta1])
|
||||
meta2.cfgimpl_get_settings().setowner(owners.meta)
|
||||
meta2.read_write()
|
||||
conf1, conf2 = meta1.cfgimpl_get_children()
|
||||
meta2.set_value('od1.i1', 7, only_config=True)
|
||||
meta2.set_value('od1.i6', 7, only_config=True)
|
||||
@ -247,6 +247,7 @@ def test_meta_unconsistent():
|
||||
raises(ValueError, "MetaConfig([conf1, conf3])")
|
||||
#not same descr
|
||||
raises(ValueError, "MetaConfig([conf3, conf4])")
|
||||
raises(ConfigError, "meta.conf1.read_only()")
|
||||
|
||||
|
||||
def test_meta_master_slaves():
|
||||
@ -257,19 +258,13 @@ def test_meta_master_slaves():
|
||||
conf1 = Config(interface1, name='conf1')
|
||||
conf2 = Config(interface1, name='conf2')
|
||||
meta = MetaConfig([conf1, conf2])
|
||||
meta.conf1.read_only()
|
||||
meta.conf2.read_only()
|
||||
meta.read_only()
|
||||
assert [conf1, conf2] == meta.find_firsts(byname='netmask_admin_eth0').cfgimpl_get_children()
|
||||
meta.conf1.read_write()
|
||||
meta.conf2.read_only()
|
||||
assert [conf2] == meta.find_firsts(byname='netmask_admin_eth0').cfgimpl_get_children()
|
||||
meta.conf2.read_write()
|
||||
meta.read_write()
|
||||
raises(AttributeError, "meta.find_firsts(byname='netmask_admin_eth0')")
|
||||
assert [conf1, conf2] == meta.find_firsts(byname='netmask_admin_eth0',
|
||||
check_properties=None).cfgimpl_get_children()
|
||||
meta.conf1.read_only()
|
||||
meta.conf2.read_only()
|
||||
meta.read_write()
|
||||
meta.read_only()
|
||||
assert [conf1, conf2] == meta.find_firsts(byname='netmask_admin_eth0').cfgimpl_get_children()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user