Skip to content

Commit

Permalink
Add conditional in get_config_block_regex
Browse files Browse the repository at this point in the history
  • Loading branch information
benedictmulongo authored and indy-independence committed Oct 21, 2024
1 parent 45271a5 commit 89d85da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cnaas_nms/tools/jinja_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ def get_config_block_regex(config:str, section: str = "firewall", parser: Option
config_parser = parser(config)
config_relationship = config_parser.build_config_relationship()
children = config_parser.find_all_children(section, match_type="regex")

if len(children) > 1:
return "\n".join(children) + "\n}"
collect = "\n".join(children)
return collect + "\n}" if isinstance(config_parser, JunosConfigParser) else collect

return []

0 comments on commit 89d85da

Please sign in to comment.