Image server always exits after wrongly processing a non-image file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu system image |
New
|
Undecided
|
Unassigned |
Bug Description
If you point image server etc/config to a file that is 404 it will try to import the error page (an Apache HTML page) and be fine with it, but the next time it runs if the file is finally present (for whatever reason, say, its build process finally finished) then the image server will always exit with the following error because it can't generate deltas for non-image files.
Importing an error 404 page (the hash is always the same unless you customize the error page):
2015-03-11 15:28:38,911 INFO Calling 'http' generator for a new file
2015-03-11 15:28:38,932 DEBUG Path generated: /srv/sis.
2015-03-11 15:28:39,005 DEBUG Signing file: /srv/sis.
2015-03-11 15:28:39,032 DEBUG Signing file: /srv/sis.
2015-03-11 15:28:39,049 INFO New file from 'http': pool/device-
Delta generation:
2015-03-11 15:50:09,271 INFO Generating delta from '1' for 'http'
2015-03-11 15:50:09,272 DEBUG Path generated: /srv/sis.
2015-03-11 15:50:09,272 DEBUG Unxzipping file: /tmp/tmp0REe1i/
xz: /srv/sis.
2015-03-11 15:50:09,300 DEBUG Unxzipping file: /tmp/tmp0REe1i/
xz: /srv/sis.
Traceback (most recent call last):
File "bin/import-
abspath)
File "/srv/system_
os.
File "/srv/system_
self.
File "/usr/lib/
return func(name, filemode, fileobj, **kwargs)
File "/usr/lib/
return cls(name, mode, fileobj, **kwargs)
File "/usr/lib/
self.
File "/usr/lib/
raise ReadError("empty file")
tarfile.ReadError: empty file
The only way to recover from this is to manually log into the machine and clear everything up myself.
Related branches
- Stéphane Graber (community): Needs Fixing
-
Diff: 172 lines (+57/-61)1 file modifiedlib/systemimage/generators.py (+57/-61)
The related branch is just an example on what's expected from image server. Of course that was more like a hack, but it solved the problem for us temporarily. Ideally all urlopen and urlretrieve should handle HTTP errors and only download/open stuff if they are really there.