Skip to content

Commit

Permalink
Strip path nodes from C path if choice/case
Browse files Browse the repository at this point in the history
We missed the setting of level if choice/case which
meant we were pringin the full path for a choice/case
even if that traversed a list key (*).
  • Loading branch information
carlgsmith authored and blairsteven committed Sep 18, 2023
1 parent 27b8db6 commit fc59aaf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyang-cpaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ def print_node(node, module, prefix, fd, ctx, level=0, strip=0):
if node.keyword in ['rpc', 'notification']:
return

# Strip all nodes from the path at list items
if node.parent.keyword == 'list':
strip = level

# Skip over choice and case
if node.keyword in ['choice', 'case']:
for child in node.i_children:
print_node(child, module, prefix, fd, ctx, level, strip)
return

# Strip all nodes from the path at list items
if node.parent.keyword == 'list':
strip = level

# Create path value
value = mk_path_str(node, prefix, level, strip, fd)
if strip == 0:
Expand Down

0 comments on commit fc59aaf

Please sign in to comment.