_CHILD_TEMPLATE = "{lineno} {indent}({parent}) {name},{instance}: \"{value}\""
_NEST_INDENT = " "
- def __init__(self, name, value, instance=-1, parent=None,
+ def __init__(self, name, value, instance=0, parent=None,
lineno=None, comment=None):
"""
Create this instance.
This method can be used in child classes to use an alternative scheme,
however for performance reasons the base API class uses the default and
relies on the cnfvar backend to do this job.
+
+ ..todo:: This method compensates for limitations in production code that
+ might end up fixed up there deprecating our patching here.
"""
def _do_commit(self, original_cnfs, arnied_cnfs, fix_problems=False):
user_cnf.value = "jane"
user_cnf.children[1].value = "Jane"
user_cnf.children.first_with_name("user_group_member_ref").value = "200"
- user_cnf.add_children(("USER_GROUP_MEMBER_REF", 5))
+ user_cnf.add_children(("USER_GROUP_MEMBER_REF", 5, -1))
# check correct types and equality
self.assertEqual(user_cnf.instance, 2)
# test adding a reference from another cnfvar
proxy_profile = store.query().with_name("PROXY_PROFILE").first_with_instance(2)
- nic_0.add_child(("nic_lan_proxy_profile_ref"), proxy_profile.instance)
+ nic_0.add_child(("nic_lan_proxy_profile_ref"), proxy_profile.instance, -1)
# testing changing the value
nic_1.children.first(lambda c: c.name == "nic_comment") \