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 committed Sep 17, 2024
1 parent 7bc603e commit b21ff9b
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")

Check warning on line 235 in src/cnaas_nms/tools/jinja_filters.py

View check run for this annotation

Codecov / codecov/patch

src/cnaas_nms/tools/jinja_filters.py#L233-L235

Added lines #L233 - L235 were not covered by tests

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

Check warning on line 239 in src/cnaas_nms/tools/jinja_filters.py

View check run for this annotation

Codecov / codecov/patch

src/cnaas_nms/tools/jinja_filters.py#L237-L239

Added lines #L237 - L239 were not covered by tests

return []

Check warning on line 241 in src/cnaas_nms/tools/jinja_filters.py

View check run for this annotation

Codecov / codecov/patch

src/cnaas_nms/tools/jinja_filters.py#L241

Added line #L241 was not covered by tests

0 comments on commit b21ff9b

Please sign in to comment.