fixed --scratch appliance output uploading xml description file treated as output rather than a log

This commit is contained in:
Jay Greguske 2010-03-09 14:19:42 -05:00 committed by Mike McLean
parent 78cfd378a7
commit a90f0d1b03
3 changed files with 20 additions and 4 deletions

View file

@ -2387,7 +2387,7 @@ class ApplianceTask(ImageTask):
self.logger.debug('output: %s' % results)
if len(results) > 2:
raise koji.ApplianceError, \
"Unexpected output found! Full list is: %s" % results
"Only one disk image allowed for output! found: %s" % results
app_path = None
for ofile in results:
@ -2420,7 +2420,9 @@ class ApplianceTask(ImageTask):
itype = img_type[self.opts.get('format')]
self.uploadFile(app_path)
image_id = session.host.importImage(self.id, app_file, filesize,
arch, itype, hash, hdrlist)
arch, itype, hash, hdrlist) # xml file automatically moved too
else:
self.uploadFile(app_path)
broot.expire()
if opts.get('scratch'):

View file

@ -5166,10 +5166,19 @@ class RootExports(object):
else:
raise koji.GenericError, 'no image for task ID: %i' % taskID
# find the accompanying xml file, if any
if ret['mediatype'] != 'LiveCD ISO':
imagepath = os.path.join(koji.pathinfo.imageFinalPath(),
koji.pathinfo.applianceRelPath(ret['id']))
out_files = os.listdir(imagepath)
for out_file in out_files:
if out_file.endswith('.xml'):
ret['xmlfile'] = out_file
# additional tweaking
if ret:
# Always return filesize as a string instead of an int so XMLRPC doesn't
# complain about 32-bit overflow
# Always return filesize as a string instead of an int so XMLRPC
# doesn't complain about 32-bit overflow
ret['filesize'] = str(ret['filesize'])
return ret

View file

@ -50,6 +50,11 @@
<tr>
<th colspan="2"><a href="$imageBase/$image.filename">Download Image</a> (<a href="$imageBase/data/logs/$image.arch/">build logs</a>)</th>
</tr>
#if $image.get('xmlfile', None)
<tr>
<th colspan="2"><a href="$imageBase/$image.xmlfile">Download XML Description</a></th>
</tr>
#end if
</table>
#include "includes/footer.chtml"