Skip to content

Commit

Permalink
Update content_templates_parser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitthakur2590 authored Jul 5, 2024
1 parent a269f23 commit 30908b8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions plugins/sub_plugins/cli_parser/content_templates_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""

EXAMPLES = """
- name: "Run command and parse with native"
- name: "Run command and parse with content_templates"
ansible.utils.cli_parse:
command: "show bgp summary"
parser:
Expand All @@ -41,7 +41,7 @@


class CliParser(CliParserBase):
"""The native parser class
"""The content_templates parser class
Convert raw text to structured data using the resource module parser
"""

Expand Down Expand Up @@ -72,8 +72,7 @@ def parse(self, *_args, **kwargs):
try:
parser.PARSERS = template_obj
out = {"parsed": parser.parse()}
print(out)
return out
except Exception as exc:
msg = "Native parser returned an error while parsing. Error: {err}"
msg = "An error occurred during content_templates parsing. Error: {err}"
return {"errors": [msg.format(err=to_native(exc))]}

0 comments on commit 30908b8

Please sign in to comment.