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

podman: change ansible_async_dir only when $HOME is redefined #173

Conversation

grcancelliere
Copy link
Contributor

@grcancelliere grcancelliere commented Jul 8, 2023

fixes #73

This PR tries to avoid the hardcoding of ansible_async_dir introduced in molecule-podman PR #139 by using ansible.builtin.getent to get the $USER passwd data and by using ansible.builtin.config to get async_dir from the shell configuration. ansible_async_dir will be set only if the two home paths are different and the value will pick up the changes set from the rest of the controller set-up.

tox.ini is also updated to allow lookup('env', 'USER') to work in the CI.

@grcancelliere grcancelliere marked this pull request as draft July 8, 2023 18:07
@grcancelliere grcancelliere force-pushed the avoid-hardcoding-ansible-async-dir branch 7 times, most recently from e7a5500 to 6729ec0 Compare July 9, 2023 06:21
@grcancelliere grcancelliere marked this pull request as ready for review July 9, 2023 06:32
@grcancelliere grcancelliere force-pushed the avoid-hardcoding-ansible-async-dir branch from 6729ec0 to 99912cd Compare July 9, 2023 06:49
@grcancelliere grcancelliere marked this pull request as draft July 9, 2023 06:55
@grcancelliere grcancelliere force-pushed the avoid-hardcoding-ansible-async-dir branch from 99912cd to 1a3f276 Compare July 9, 2023 07:13
@grcancelliere grcancelliere marked this pull request as ready for review July 9, 2023 07:35
@grcancelliere grcancelliere marked this pull request as draft August 1, 2023 09:15
- src/molecule_plugins/podman/playbooks: reworked the ansible_async_dir logic:
  - use ansible.builtin.getent to get the passwd information for $USER
  - use the ansible.builtin.config lookup to get the async_dir information
  - set ansible_async_dir by rewriting the home folder only if the two home paths are different
- tox.ini: add USER to the pass_env list, since the new ansible_async_dir logic
  relies on looking up the equivalent of getent passwd $USER
@grcancelliere grcancelliere force-pushed the avoid-hardcoding-ansible-async-dir branch from 1a3f276 to 81296ca Compare August 1, 2023 09:16
@grcancelliere grcancelliere marked this pull request as ready for review August 1, 2023 09:23
@audgirka audgirka added enhancement New feature or request podman labels Aug 1, 2023
@audgirka audgirka merged commit b5509a1 into ansible-community:main Aug 1, 2023
@grcancelliere grcancelliere deleted the avoid-hardcoding-ansible-async-dir branch August 4, 2023 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request podman
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[podman] create.yml and destroy.yml hardcode ansible_async_dir
2 participants