Commit 00a36e75 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[master] Merge branch 'trac1491'

parents 5dcf1dad 55cecba6
......@@ -42,7 +42,7 @@ def spec_part_is_map(spec_part):
def spec_part_is_named_set(spec_part):
"""Returns True if the given spec_part is a dict that contains a
named_set specification, and False otherwise."""
return (type(spec_part) == dict and 'named_map_item_spec' in spec_part)
return (type(spec_part) == dict and 'named_set_item_spec' in spec_part)
def check_type(spec_part, value):
"""Does nothing if the value is of the correct type given the
......@@ -730,6 +730,15 @@ class MultiConfigData:
cur_id_part + id,
cur_id_part = cur_id_part + id_part + "/"
# We also need to copy to local if we are changing a named set,
# so that the other items in the set do not disappear
if spec_part_is_named_set(self.find_spec_part(cur_id_part)):
ns_value, ns_status = self.get_value(cur_id_part)
if ns_status != MultiConfigData.LOCAL:,
ns_value), identifier, value)
def _get_list_items(self, item_name):
......@@ -720,6 +720,12 @@ class TestMultiConfigData(unittest.TestCase):
config_items ="Spec2", True)
self.assertEqual(['Spec2/item1', 'Spec2/item2', 'Spec2/item3', 'Spec2/item4', 'Spec2/item5', 'Spec2/item6/value1', 'Spec2/item6/value2'], config_items)
def test_is_named_set(self):
module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec32.spec")
spec_part ="Spec32/named_set_item")
def test_get_config_item_list_named_set(self):
config_items =
self.assertEqual([], config_items)
......@@ -738,6 +744,20 @@ class TestMultiConfigData(unittest.TestCase):
], config_items)
def test_set_named_set_nonlocal(self):
# Test whether a default named set is copied to local if a subitem
# is changed, and that other items in the set do not get lost
module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + 'spec32.spec')
value, status ='Spec32/named_set_item')
self.assertEqual({'a': 1, 'b': 2}, value)
self.assertEqual(MultiConfigData.DEFAULT, status)'Spec32/named_set_item/b', 3)
value, status ='Spec32/named_set_item')
self.assertEqual({'a': 1, 'b': 3}, value)
self.assertEqual(MultiConfigData.LOCAL, status)
if __name__ == '__main__':
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment