-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[backport][release_2.3] Fix artifact file permissions
* Fix artifact file permissions (#702, #853) Sets artifact file permissions to octal `600` in `ansible_runner.utils.dump_artifact` (cherry picked from commit a4a981d) Co-authored-by: Sam Caldwell <shoriminimoe@pm.me>
- Loading branch information
1 parent
b858da8
commit 22c4555
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
import stat | ||
|
||
from ansible_runner.utils import dump_artifact | ||
|
||
|
||
def test_artifact_permissions(tmp_path): | ||
"""Artifacts should allow user read/write""" | ||
filename = dump_artifact("artifact content", str(tmp_path)) | ||
file_mode = stat.S_IMODE(os.stat(filename).st_mode) | ||
user_rw = stat.S_IRUSR | stat.S_IWUSR | ||
assert (user_rw & file_mode) == user_rw, "file mode is incorrect" |