cli_parse: Fix finding relative template_path when used inside role/collection (#333)
* Fix finding relative template_path when provided This allows parser.template_path to behave as expected inside roles or collections when a path relative to the role/collection directory is provided. * add tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update tests * add working tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * updates * minor changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Delete tests/integration/inventory * add tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add netcommon dependency * changes * delete tests as CI is failing * changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Mark Vasi <mark.vasi@embedit.com> Co-authored-by: Ruchi Pakhle <ruchipakhle@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com>pull/361/head^2
parent
db14f96453
commit
8cba2c3b9e
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
minor_changes:
|
||||
- Allows the cli_parse module to find parser.template_path inside roles or collections when a path relative to the role/collection directory is provided.
|
|
@ -165,6 +165,9 @@ class ActionModule(ActionBase):
|
|||
cmd_as_fname = self._task.args.get("parser").get("command").replace(" ", "_")
|
||||
fname = "{os}_{cmd}.{ext}".format(os=oper_sys, cmd=cmd_as_fname, ext=template_extension)
|
||||
source = self._find_needle("templates", fname)
|
||||
else:
|
||||
source = self._task.args.get("parser").get("template_path")
|
||||
source = self._find_needle("templates", source)
|
||||
self._debug("template_path in task args updated to {source}".format(source=source))
|
||||
self._task.args["parser"]["template_path"] = source
|
||||
|
||||
|
|
Loading…
Reference in New Issue