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

Fix gather_facts for Windows and shell dirname #83275

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

jborean93
Copy link
Contributor

SUMMARY

Fix parallel fact gather in gather_facts when targeting Windows by ensuring the modules are run in async mode.

Also added the dirname method to shell plugins to allow callers to get a shell specific parent directory path.

Fixes: #83219

ISSUE TYPE
  • Bugfix Pull Request
  • Feature Pull Request

Fix parallel fact gather in gather_facts when targeting Windows by
ensuring the modules are run in async mode.

Also added the dirname method to shell plugins to allow callers to get a
shell specific parent directory path.
@ansibot ansibot added bug This issue/PR relates to a bug. feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. has_issue labels May 20, 2024
def dirname(self, path: str) -> str:
# Using os.path.dirname will return an empty string when path uses
# backslashes. Using ntpath can handle both cases for Windows.
return ntpath.dirname(path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add basename/abspath/norm to the shells or just as we find a need for them?

Copy link
Contributor Author

@jborean93 jborean93 May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably would do it as is, I was very reluctant to add more to the shell plugin just for this. Plus doing so here will make it harder to backport the fix as well.

Personally the better fix in my mind is to just pass in the results file as a single path rather than have async_status rebuild it from a dir and filename but as async_status for PowerShell is no longer in this repo we can't really make that change.

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label May 21, 2024
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug. feature This issue/PR relates to a feature request. has_issue stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested.
Projects
None yet
3 participants