only pass non-null options to createLiveCD

This commit is contained in:
Mike Bonnet 2009-09-29 11:12:51 -04:00
parent 33dd85fcd9
commit f39637bf2a
4 changed files with 19 additions and 23 deletions

View file

@ -2170,6 +2170,8 @@ class LiveCDTask(BaseTaskHandler):
_taskWeight = 1.5
def handler(self, arch, target, ksfile, opts=None):
if not opts:
opts = {}
global options
target_info = session.getBuildTarget(target)
@ -2215,7 +2217,7 @@ class LiveCDTask(BaseTaskHandler):
scmdir = os.path.join(broot.rootdir(), tmpchroot[1:])
koji.ensuredir(scmdir)
self.logger.debug("ksfile = %s" % ksfile)
if opts['scmurl']:
if opts.get('scmurl'):
scm = SCM(opts['scmurl'])
scm.assert_allowed(options.allowed_scms)
logfile = os.path.join(self.workdir, 'checkout.log')
@ -2251,7 +2253,7 @@ class LiveCDTask(BaseTaskHandler):
"'%s' : %s" % (ksfile, e))
ks.handler.repo.repoList = [] # delete whatever the ks file told us
if opts['repo']:
if opts.get('repo'):
user_repos = opts['repo'].split(',')
index = 0
for user_repo in user_repos:
@ -2331,7 +2333,7 @@ class LiveCDTask(BaseTaskHandler):
# copy the iso out of the chroot. If we were given an isoname, this is
# where the renaming happens.
self.logger.debug('uploading image: %s' % isosrc)
if opts['isoname']:
if opts.get('isoname'):
isofile = opts['isoname']
if not isofile.endswith('.iso'):
isofile += '.iso'
@ -2342,7 +2344,7 @@ class LiveCDTask(BaseTaskHandler):
self.genImageManifest(isosrc, manifest)
self.uploadFile(manifest)
if not opts['scratch']:
if not opts.get('scratch'):
# Read the rpm header information from the yum cache livecd-creator
# used. We assume it was empty to start.
#
@ -2386,7 +2388,7 @@ class LiveCDTask(BaseTaskHandler):
'LiveCD ISO', hash, hdrlist)
broot.expire()
if opts['scratch']:
if opts.get('scratch'):
return 'Scratch image created: %s' % \
os.path.join(koji.pathinfo.work(),
koji.pathinfo.taskrelpath(self.id), isofile)

View file

@ -3885,10 +3885,9 @@ def handle_spin_livecd(options, session, args):
print
livecd_opts = {}
livecd_opts['scmurl'] = task_options.scmurl
livecd_opts['isoname'] = task_options.isoname
livecd_opts['scratch'] = task_options.scratch
livecd_opts['repo'] = task_options.repo
for opt in ['scratch', 'scmurl', 'isoname', 'repo']:
if getattr(task_options, opt):
livecd_opts[opt] = getattr(task_options, opt)
# finally, create the task. Flow continues in kojihub::livecd.
task_id = session.livecd(arch, target, ksfile, opts=livecd_opts,

View file

@ -511,10 +511,6 @@ def taskinfo(req, taskID):
buildTag = server.getTag(params[1])
values['buildTag'] = buildTag
elif task['method'] == 'createLiveCD':
# 'arch' is param[0], which is already mentioned later in the page.
values['target'] = params[1]
values['kickstart'] = os.path.basename(params[2])
values['opts'] = params[3]
values['image'] = server.getImageInfo(taskID=taskID)
elif task['method'] == 'buildSRPMFromSCM':
if len(params) > 1:
@ -599,7 +595,7 @@ def taskstatus(req, taskID):
files = server.listTaskOutput(taskID, stat=True)
output = '%i:%s\n' % (task['id'], koji.TASK_STATES[task['state']])
for filename, file_stats in files.items():
output += '%s:%i\n' % (filename, file_stats['st_size'])
output += '%s:%s\n' % (filename, file_stats['st_size'])
return output

View file

@ -117,9 +117,12 @@
<strong>Build Target:</strong> <a href="buildtargetinfo?name=$params[1]">$params[1]</a><br/>
$printOpts($params[2])
#elif $task.method == 'createLiveCD'
<strong>Target:</strong> $target<br/>
<strong>Kickstart File:</strong> $kickstart<br/>
$printOpts($opts)
<strong>Arch:</strong> $params[0]<br/>
<strong>Target:</strong> <a href="buildtargetinfo?name=$params[1]">$params[1]</a><br/>
<strong>Kickstart File:</strong> $params[2]<br/>
#if $len($params) > 3
$printOpts($params[3])
#end if
#elif $task.method == 'newRepo'
<strong>Tag:</strong> <a href="taginfo?tagID=$tag.id">$tag.name</a><br/>
#if $len($params) > 1
@ -240,18 +243,14 @@
</td>
</tr>
#end if
#if $task.method == 'createLiveCD'
#if $task.method == 'createLiveCD' and $image
<tr>
<th>Image Information</th>
<td>
#if $image
<a href="imageinfo?imageID=$image.id">$image.filename</a><br/>
#elif $opts.scratch
Scratch image, no information will be saved.<br/>
#end if
</td>
</tr>
#end if
#end if
<tr>
<th>Parent</th>
<td>