-
Notifications
You must be signed in to change notification settings - Fork 5
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
Remove aiofiles dependency #135
Conversation
What kind of issues? |
Was running into permissions errors. It wasn't entirely aiofiles, but the way we were opening and closing files. We opened the temp file at the top level, then tried to open it again in a function called inside that with block, and that was causing issues. In this case though, I don't really see any reason to use aiofiles or temp files here, there doesn't seem like much benefit... |
Remove dependency on aiofiles, `NamedTemporaryFile` was causing issues. Replace temporary files with a temporary file in `artifacts/tmp`.
78786ac
to
4b61382
Compare
LGTM. Great to have that dependency removed! |
await f.write(await file.read()) | ||
absolute = await file_path.absolute() | ||
software = await create_software_update(absolute.as_uri(), Path(f.name)) | ||
tmp_file_path = artifacts_dir.joinpath("tmp", ("".join(random.choices(string.ascii_lowercase, k=12)) + ".tmp")) |
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 change makes the artifact directory mandatory. Before, it was optional (when only using external artifacts) as temporary files were created in /tmp
😞
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.
Didn't even think about this. Maybe I can generate a temporary file location other than this?
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.
IMHO it is best to use a standard temp location. But, we should make sure it works on all OSes.
Remove dependency on aiofiles,
NamedTemporaryFile
was causing issues. Replace temporary files with a temporary file inartifacts/tmp
.