Skip to content

Commit db14f96

Browse files
authored
Removed conditional check for deprecated ansible.netcommon.cli_parse (#362)
* Removed conditional check for deprecated ansible.netcommon.cli_parse * remove warning when using netcommon parser
1 parent 6c1c3a4 commit db14f96

File tree

2 files changed

+3
-40
lines changed

2 files changed

+3
-40
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
minor_changes:
3+
- Removed conditional check for deprecated ansible.netcommon.cli_parse from ansible.utils.cli_parse

plugins/action/cli_parse.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,6 @@ def _load_parser(self, task_vars):
100100
"""
101101
requested_parser = self._task.args.get("parser").get("name")
102102
cref = dict(zip(["corg", "cname", "plugin"], requested_parser.split(".")))
103-
if cref["cname"] == "netcommon" and cref["plugin"] in [
104-
"json",
105-
"textfsm",
106-
"ttp",
107-
"xml",
108-
]:
109-
cref["cname"] = "utils"
110-
msg = (
111-
"Use 'ansible.utils.{plugin}' for parser name instead of '{requested_parser}'."
112-
" This feature will be removed from 'ansible.netcommon' collection in a release"
113-
" after 2022-11-01".format(plugin=cref["plugin"], requested_parser=requested_parser)
114-
)
115-
self._display.warning(msg)
116103

117104
parserlib = "ansible_collections.{corg}.{cname}.plugins.sub_plugins.cli_parser.{plugin}_parser".format(
118105
**cref,
@@ -126,33 +113,6 @@ def _load_parser(self, task_vars):
126113
)
127114
return parser
128115
except Exception as exc:
129-
# TODO: The condition is added to support old sub-plugin structure.
130-
# Remove the if condition after ansible.netcommon.cli_parse module is removed
131-
# from ansible.netcommon collection
132-
if cref["cname"] == "netcommon" and cref["plugin"] in [
133-
"native",
134-
"content_templates",
135-
"ntc",
136-
"pyats",
137-
]:
138-
parserlib = (
139-
"ansible_collections.{corg}.{cname}.plugins.cli_parsers.{plugin}_parser".format(
140-
**cref,
141-
)
142-
)
143-
try:
144-
parsercls = getattr(import_module(parserlib), self.PARSER_CLS_NAME)
145-
parser = parsercls(
146-
task_args=self._task.args,
147-
task_vars=task_vars,
148-
debug=self._debug,
149-
)
150-
return parser
151-
except Exception as exc:
152-
self._result["failed"] = True
153-
self._result["msg"] = "Error loading parser: {err}".format(err=to_native(exc))
154-
return None
155-
156116
self._result["failed"] = True
157117
self._result["msg"] = "Error loading parser: {err}".format(err=to_native(exc))
158118
return None

0 commit comments

Comments
 (0)