get-list-length also works for state data

parent 20a33f9c
......@@ -836,12 +836,18 @@ class BaseDatastore:
except (TypeError, KeyError):
raise ValueError("This operation expects \"url\" input parameter")
if list_url == "":
list_ii = []
else:
list_ii = self.parse_ii(list_url, PathFormat.URL)
try:
staging = rpc.op_input_args["staging"] # type: str
except (TypeError, KeyError):
staging = False
rpc_gll = RpcInfo()
rpc_gll.username = rpc.username
rpc_gll.path = list_url.rstrip("/")
rpc_gll.qs = {}
ln_val = self.get_node_rpc(rpc_gll, staging).value
ln_val = self._data.goto(list_ii).value
if isinstance(ln_val, list):
ret_data = {"jetconf:list-length": len(ln_val)}
else:
......
......@@ -634,7 +634,7 @@ def create_api_op(ds: BaseDatastore):
ERRTAG_ACCDENIED,
exception=e
)
except NonexistentSchemaNode as e:
except (NonexistentSchemaNode, NonexistentInstance) as e:
http_resp = HttpResponse.error(
HttpStatus.NotFound,
RestconfErrType.Protocol,
......
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