Fix async_dir variable expansion to match remote_tmp - #85375
Open
seb-goodman wants to merge 1 commit into
Open
Conversation
bcoca
reviewed
Jun 23, 2025
s-hertel
requested changes
Jun 25, 2025
s-hertel
reviewed
Jun 25, 2025
Comment on lines
+283
to
+293
| - name: test async with $HOME variable expansion | ||
| command: echo "test" | ||
| async: 5 | ||
| poll: 1 | ||
| vars: | ||
| ansible_async_dir: "$HOME/.ansible_test_var_expansion" | ||
|
|
||
| - name: verify $HOME was expanded and cleanup | ||
| file: | ||
| path: "{{ ansible_env.HOME }}/.ansible_test_var_expansion" | ||
| state: absent |
Contributor
There was a problem hiding this comment.
Can you also add a test using async_status to cleanup an async directory? https://docs.ansible.com/ansible/latest/collections/ansible/builtin/async_status_module.html#parameter-mode
Contributor
|
Is the PR expected to fix #81805 as well ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Fix async_dir variable expansion to match remote_tmp behavior.
The async_wrapper module was using
os.path.expanduser(). This caused shell variables like$HOMEto be treated as literal directory names, resulting in directories like/home/admin/$HOMEbeing created.Adds
os.path.expandvars()to the async directory setup in async_wrapper.py, and hopefully better aligns with the expansion behavior used by remote_tmp in basic.py.I haven't addressed any ownership issues or made any changes to async_dir default, but can take a look at this if happy with current PR and this would be helpful.
Fixes #85370
ISSUE TYPE