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

Use os.path.expanduser("~") instead of os.environ["HOME"] #5398

Merged
merged 1 commit into from
Jul 2, 2023

Conversation

AdamWill
Copy link
Contributor

On openQA staging, some code that runs bodhi updates download via subprocess was failing. Somehow in that context "HOME" wasn't in os.environ, so bodhi would crash, because it assumes that will be the case.

This should make it more robust, by using os.path.expanduser instead. As documented:
https://docs.python.org/3/library/os.path.html#os.path.expanduser it has fallback ways to get the path if the obvious one doesn't work.

@AdamWill AdamWill requested a review from a team as a code owner June 30, 2023 20:31
On openQA staging, some code that runs `bodhi updates download`
via `subprocess` was failing. Somehow in that context "HOME"
wasn't in `os.environ`, so bodhi would crash, because it
assumes that will be the case.

This should make it more robust, by using os.path.expanduser
instead. As documented:
https://docs.python.org/3/library/os.path.html#os.path.expanduser
it has fallback ways to get the path if the obvious one doesn't
work.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
@mattiaverga mattiaverga added the 7.2-backports Mergify uses this to backport patches to 7.2 label Jul 2, 2023
Copy link
Contributor

@mattiaverga mattiaverga left a comment

Choose a reason for hiding this comment

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

Rawhide failure is due to dnf5 not recognizing --repofrompath option (it should be fixed in a future release), not related to the PR.

@mergify mergify bot merged commit 2f17c45 into fedora-infra:develop Jul 2, 2023
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.2-backports Mergify uses this to backport patches to 7.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants