-
Notifications
You must be signed in to change notification settings - Fork 116
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
Have downloads always end up under WORKING_DIRECTORY #5913
Conversation
pulpcore/download/base.py
Outdated
work_dir = str(settings.WORKING_DIRECTORY) | ||
self._writer = tempfile.NamedTemporaryFile( | ||
dir="." if work_dir in os.getcwd() else work_dir, | ||
suffix=suffix, | ||
delete=False, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears like this is a better variant of what I was trying to do in the past: pulp/pulp_container#1299 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm doing something similar with my new work on pull-through caching in pulp-python and I thought I should just move the fix into pulpcore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this feels like patching over a deeper issue. But well.
I think we should leave a comment on why this is important and the assumptions that lead to there.
pulpcore/download/base.py
Outdated
work_dir = str(settings.WORKING_DIRECTORY) | ||
self._writer = tempfile.NamedTemporaryFile( | ||
dir="." if work_dir in os.getcwd() else work_dir, | ||
suffix=suffix, | ||
delete=False, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this feels like patching over a deeper issue. But well.
I think we should leave a comment on why this is important and the assumptions that lead to there.
pulpcore/download/base.py
Outdated
self._writer = tempfile.NamedTemporaryFile(dir=".", suffix=suffix, delete=False) | ||
work_dir = str(settings.WORKING_DIRECTORY) | ||
self._writer = tempfile.NamedTemporaryFile( | ||
dir="." if work_dir in os.getcwd() else work_dir, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a simple string comparison. So at least it should be os.getcwd().startswith(work_dir)
. But i think i'd prefer using pathlib at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, updated to use pathlib logic and added a simple comment for the check.
5aa97ce
to
1253603
Compare
Backport to 3.49: 💚 backport PR created✅ Backport PR branch: Backported as #5926 🤖 @patchback |
fixes: #5912