Fix NotADirectoryError in tools/pkg/build.py salt_onedir#69462
Open
dwoz wants to merge 2 commits into
Open
Conversation
Commit 9c268db added a `git add -f salt/_version.txt` invocation inside `salt_onedir` with `cwd=str(salt_archive)`, but `salt_archive` is a path to a `.tar.gz` file, not a directory. Python's subprocess implementation calls `chdir()` on `cwd` and raises: NotADirectoryError: [Errno 20] Not a directory: '/.../salt-3008.0+NNN.gSHA.tar.gz' This blocks the Build Salt Onedir job on Linux and macOS for every master PR. The Windows path takes a different branch (`pkg\\windows\\install_salt.cmd`) and is unaffected. The `salt_onedir` step runs in the salt source checkout (the CI working tree), which is a real git repository containing `salt/_version.txt`, so dropping the `cwd=` argument lets the subprocess inherit that directory and the `git add` works as the original commit intended. Reproducer: import subprocess subprocess.run(['echo', 'x'], cwd='/tmp/anything.tar.gz') # NotADirectoryError: [Errno 20] Not a directory: '/tmp/anything.tar.gz' Fixes saltstack#69461 Refs 9c268db
…rors Forward-port from 3008.x commit 3fafbbe to master: - salt/states/file.py: prefix the early `_error()` return in `file.managed` with "Unable to manage file:" so callers and tests can reliably distinguish the manage-file failure path from other state errors. Restores the assertion checked by tests/pytests/functional/states/file/test_managed.py::test_issue_60203, which is failing across every functional-zeromq-3 chunk on master. - salt/modules/file.py: route the `source_hash` value through `salt.utils.url.redact_http_basic_auth()` in both the "format is invalid" and "Source hash file not found" error paths of `get_source_sum()` so HTTP basic-auth credentials are not leaked into state comments or logs when the source hash URI is malformed or unreachable.
b26d387 to
c7aede9
Compare
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
git add -f salt/_version.txtinvocation insidesalt_onedirwithcwd=str(salt_archive), butsalt_archiveis a.tar.gzfile path, not a directory. Python'ssubprocesscallschdir()oncwdand raisesNotADirectoryError: [Errno 20] Not a directory: '/.../salt-3008.0+NNN.gSHA.tar.gz'.Build Salt Onedirjob on Linux and macOS for every master PR. The Windows path takes a different branch (pkg\windows\install_salt.cmd) and is unaffected.salt_onedirstep runs in the salt source checkout (the CI working tree), which is a real git repository containingsalt/_version.txt. Dropping the brokencwd=argument lets the subprocess inherit that directory and thegit addworks as the original commit intended.Fixes #69461
Refs 9c268db
Reproducer
Test plan
Build Salt Onedirjobs (Linux + macOS) succeed on this PR.salt/_version.txtvia setuptools_scm.