Removed unnecessary method of BaseDatastore

parent 261d8540
...@@ -303,11 +303,6 @@ class BaseDatastore: ...@@ -303,11 +303,6 @@ class BaseDatastore:
return h_res return h_res
# Just get the node, do not evaluate NACM (needed for NACM)
def get_node(self, root: InstanceNode, ii: InstanceRoute) -> InstanceNode:
n = root.goto(ii)
return n
# Get data node, evaluate NACM if required # Get data node, evaluate NACM if required
def get_node_rpc(self, rpc: RpcInfo, yl_data=False) -> InstanceNode: def get_node_rpc(self, rpc: RpcInfo, yl_data=False) -> InstanceNode:
ii = DataHelpers.parse_ii(rpc.path, rpc.path_format) ii = DataHelpers.parse_ii(rpc.path, rpc.path_format)
......
...@@ -18,7 +18,7 @@ class KnotConfServerListener(BaseDataListener): ...@@ -18,7 +18,7 @@ class KnotConfServerListener(BaseDataListener):
base_ii_str = self.schema_path base_ii_str = self.schema_path
base_ii = DataHelpers.parse_ii(base_ii_str, PathFormat.URL) base_ii = DataHelpers.parse_ii(base_ii_str, PathFormat.URL)
base_nv = self.ds.get_node(self.ds.get_data_root(), base_ii).value base_nv = self.ds.get_data_root().goto(base_ii).value
knot_api.KNOT.begin() knot_api.KNOT.begin()
...@@ -52,7 +52,7 @@ class KnotConfLogListener(BaseDataListener): ...@@ -52,7 +52,7 @@ class KnotConfLogListener(BaseDataListener):
base_ii_str = self.schema_path base_ii_str = self.schema_path
base_ii = DataHelpers.parse_ii(base_ii_str, PathFormat.URL) base_ii = DataHelpers.parse_ii(base_ii_str, PathFormat.URL)
base_nv = self.ds.get_node(self.ds.get_data_root(), base_ii).value base_nv = self.ds.get_data_root().goto(base_ii).value
knot_api.KNOT.begin() knot_api.KNOT.begin()
knot_api.KNOT.set_item(section="log", data=None) knot_api.KNOT.set_item(section="log", data=None)
...@@ -98,7 +98,7 @@ class KnotConfZoneListener(BaseDataListener): ...@@ -98,7 +98,7 @@ class KnotConfZoneListener(BaseDataListener):
debug_confh("Editing config of zone \"{}\"".format(domain)) debug_confh("Editing config of zone \"{}\"".format(domain))
# Write whole zone config to Knot # Write whole zone config to Knot
zone_nv = self.ds.get_node(self.ds.get_data_root(), ii[0:(len(base_ii) + 1)]).value zone_nv = self.ds.get_data_root().goto(ii[0:(len(base_ii) + 1)]).value
knot_api.KNOT.set_item(section="zone", zone=domain, item="comment", data=zone_nv.get("description")) knot_api.KNOT.set_item(section="zone", zone=domain, item="comment", data=zone_nv.get("description"))
knot_api.KNOT.set_item(section="zone", zone=domain, item="file", data=zone_nv.get("file")) knot_api.KNOT.set_item(section="zone", zone=domain, item="file", data=zone_nv.get("file"))
knot_api.KNOT.set_item_list(section="zone", zone=domain, item="master", data=zone_nv.get("master")) knot_api.KNOT.set_item_list(section="zone", zone=domain, item="master", data=zone_nv.get("master"))
...@@ -132,7 +132,7 @@ class KnotConfControlListener(BaseDataListener): ...@@ -132,7 +132,7 @@ class KnotConfControlListener(BaseDataListener):
base_ii_str = self.schema_path base_ii_str = self.schema_path
base_ii = DataHelpers.parse_ii(base_ii_str, PathFormat.URL) base_ii = DataHelpers.parse_ii(base_ii_str, PathFormat.URL)
base_nv = self.ds.get_node(self.ds.get_data_root(), base_ii).value base_nv = self.ds.get_data_root().goto(base_ii).value
knot_api.KNOT.begin() knot_api.KNOT.begin()
knot_api.KNOT.set_item(section="control", item="listen", data=base_nv.get("unix")) knot_api.KNOT.set_item(section="control", item="listen", data=base_nv.get("unix"))
...@@ -164,14 +164,14 @@ class KnotConfAclListener(BaseDataListener): ...@@ -164,14 +164,14 @@ class KnotConfAclListener(BaseDataListener):
base_ii_str = self.schema_path base_ii_str = self.schema_path
base_ii = DataHelpers.parse_ii(base_ii_str, PathFormat.URL) base_ii = DataHelpers.parse_ii(base_ii_str, PathFormat.URL)
base_nv = self.ds.get_node(self.ds.get_data_root(), base_ii).value base_nv = self.ds.get_data_root().goto(base_ii).value
knot_api.KNOT.begin() knot_api.KNOT.begin()
knot_api.KNOT.set_item(section="acl", data=None) knot_api.KNOT.set_item(section="acl", data=None)
if (len(ii) > len(base_ii)) and isinstance(ii[len(base_ii)], EntryKeys): if (len(ii) > len(base_ii)) and isinstance(ii[len(base_ii)], EntryKeys):
# Write only changed list item # Write only changed list item
acl_nv = self.ds.get_node(self.ds.get_data_root(), ii[0:(len(base_ii) + 1)]).value acl_nv = self.ds.get_data_root().goto(ii[0:(len(base_ii) + 1)]).value
print("acl nv={}".format(acl_nv)) print("acl nv={}".format(acl_nv))
self._process_list_item(acl_nv) self._process_list_item(acl_nv)
else: else:
......
Markdown is supported
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