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

Conversation

Mark0016
Copy link
Contributor

SUMMARY

This 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.
This makes behavior consistent with core modules like copy and template when paths are provided this way.

Fixes #332

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

cli_parse

ADDITIONAL INFORMATION

See #332 for reproduction of the issue.
I used the same setup to validate that the changes fixed it.
With these changes cli_parse behaves as expected

$ ansible-playbook -v test_playbook.yml
No config file found; using defaults
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit
localhost does not match 'all'

PLAY [Use role with cli_parse template] **************************************************************

TASK [test_role : use custom cli_parse template] *****************************************************
ok: [localhost] => {"changed": false, "parsed": {"data": ["foo", "bar"]}}

PLAY RECAP *******************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Mark Vasi and others added 2 commits July 4, 2024 16:40
This allows parser.template_path to behave as expected inside roles or
collections when a path relative to the role/collection directory is
provided.
Copy link
Contributor

@Ruchip16 Ruchip16 marked this pull request as draft July 5, 2024 08:44
@Ruchip16 Ruchip16 marked this pull request as ready for review July 25, 2024 09:37
Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

@Ruchip16 Ruchip16 merged commit 8cba2c3 into ansible-collections:main Jul 25, 2024
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cli_parse not finding relative template_path when used in role
3 participants