Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli_parse: Fix finding relative template_path when used inside role/collection #333

Merged
merged 24 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d45cd9c
Fix finding relative template_path when provided
Feb 13, 2024
b890e3d
add tests
Ruchip16 Jul 5, 2024
345d223
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 5, 2024
0203550
update tests
Ruchip16 Jul 5, 2024
9fb1679
Merge branch 'cli_parse_find_needle' of github.com:Mark0016/ansible.u…
Ruchip16 Jul 5, 2024
1af3ac8
add working tests
Ruchip16 Jul 25, 2024
fd340f1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 25, 2024
c5e75b7
Merge branch 'main' into cli_parse_find_needle
Ruchip16 Jul 25, 2024
fe2d42b
updates
Ruchip16 Jul 25, 2024
a1423de
Merge branch 'cli_parse_find_needle' of github.com:Mark0016/ansible.u…
Ruchip16 Jul 25, 2024
d5cb2bc
minor changes
Ruchip16 Jul 25, 2024
cd463a3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 25, 2024
2fc5437
Delete tests/integration/inventory
Ruchip16 Jul 25, 2024
62940d7
add tests
Ruchip16 Jul 25, 2024
33f5427
Merge branch 'cli_parse_find_needle' of github.com:Mark0016/ansible.u…
Ruchip16 Jul 25, 2024
3e5a675
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 25, 2024
7c1eb9d
add netcommon dependency
Ruchip16 Jul 25, 2024
19709a9
Merge branch 'cli_parse_find_needle' of github.com:Mark0016/ansible.u…
Ruchip16 Jul 25, 2024
4a363d4
changes
Ruchip16 Jul 25, 2024
aa4ce7e
Merge branch 'main' into cli_parse_find_needle
Ruchip16 Jul 25, 2024
3ac1771
delete tests as CI is failing
Ruchip16 Jul 25, 2024
2ead080
Merge branch 'cli_parse_find_needle' of github.com:Mark0016/ansible.u…
Ruchip16 Jul 25, 2024
18162be
changes
Ruchip16 Jul 25, 2024
792f2e5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/add_template_path.yaml
Original file line number Diff line number Diff line change
@@ -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.
Ruchip16 marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 5 additions & 2 deletions plugins/action/cli_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,11 @@ def _update_template_path(self, template_extension):
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)
self._debug("template_path in task args updated to {source}".format(source=source))
self._task.args["parser"]["template_path"] = source
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

def _get_template_contents(self):
"""Retrieve the contents of the parser template
Expand Down
Loading