Merge lp:~jml/pkgme-service/directory-already-exists into lp:pkgme-service
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Jonathan Lange | ||||
Approved revision: | 73 | ||||
Merged at revision: | 64 | ||||
Proposed branch: | lp:~jml/pkgme-service/directory-already-exists | ||||
Merge into: | lp:pkgme-service | ||||
Diff against target: |
226 lines (+112/-34) 2 files modified
src/djpkgme/tasks.py (+95/-24) src/djpkgme/tests/test_tasks.py (+17/-10) |
||||
To merge this branch: | bzr merge lp:~jml/pkgme-service/directory-already-exists | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Westby (community) | Approve | ||
Review via email:
|
Commit message
Handle empty package_names
Description of the change
When submitting a PDF to pkgme-service on production, we get the following error:
Traceback (most recent call last):
File "/usr/lib/
return cls(states.SUCCESS, retval=fun(*args, **kwargs))
File "/usr/lib/
return self.run(*args, **kwargs)
File "/srv/pkgme-
packaged_
File "/srv/pkgme-
download_path, output_dir, metadata[
File "/srv/pkgme-
os.
File "/usr/lib/
mkdir(name, mode)
OSError: [Errno 17] File exists
The error is caused by 'package_name' being an empty string. I've attacked this problem from two sides:
1. Rely on submitted data from MyApps as little as possible. Especially, do not rely on submitted package_name.
2. Structure our directory & file creation to avoid name clashes where possible.
The old 'extraction_path' metaphor is gone, replaced with the idea of 'working_path'. i.e. the place where pkgme does its work. It's created in a hard-coded location (WORKING_
To avoid clashes, the downloaded file is stored in its own directory, DOWNLOAD_
In addition, I've documented what's going on with the directories, and what keys this part of the chain actually expects.
Hi,
This looks good, and is much clearer.
99 + # | \-- devportal- metadata. json (moved out before packaging built)
I "packaging built" means the source package being put in to a tarball? It
may be confused with running pkgme and building the source package, so maybe
"moved out of the way before output tarball is created"?
Thanks,
James