missing hyphen

This commit is contained in:
Mike Bonnet 2009-10-02 17:46:28 -04:00
commit 722923c484
13 changed files with 895 additions and 57 deletions

View file

@ -4028,6 +4028,98 @@ def handle_remove_external_repo(options, session, args):
continue
session.removeExternalRepoFromTag(tag, repo)
# This handler is for spinning livecd images
#
def handle_spin_livecd(options, session, args):
"""[admin] Create a live CD image given a kickstart file"""
# Usage & option parsing.
usage = _("usage: %prog spin-livecd [options] <target> <arch> " +
"<kickstart-file>")
usage += _("\n(Specify the --help global option for a list of other " +
"help options)")
parser = OptionParser(usage=usage)
parser.add_option("--nowait", action="store_true",
help=_("Don't wait on livecd creation"))
parser.add_option("--noprogress", action="store_true",
help=_("Do not display progress of the upload"))
parser.add_option("--background", action="store_true",
help=_("Run the livecd creation task at a lower priority"))
parser.add_option("--isoname",
help=_("Use a custom name for the iso file"))
parser.add_option("--ksurl", metavar="SCMURL",
help=_("The URL to the SCM containing the kickstart file"))
parser.add_option("--ksversion", metavar="VERSION",
help=_("The syntax version used in the kickstart file"))
parser.add_option("--scratch", action="store_true",
help=_("Create a scratch LiveCD image."))
parser.add_option("--repo",
help=_("Specify a comma-separated list of repos that will override\n" +
"the repo used to install RPMs in the LiveCD image. The \n" +
"repo associated with the target is the default."))
(task_options, args) = parser.parse_args(args)
# Make sure the target and kickstart is specified.
if len(args) != 3:
parser.error(_("Three arguments are required: an architecture, " +
"a build target, and a relative \npath to a " +
"kickstart file ."))
assert False
activate_session(session)
# Set the task's priority. Users can only lower it with --background.
priority = None
if task_options.background:
# relative to koji.PRIO_DEFAULT; higher means a "lower" priority.
priority = 5
if _running_in_bg() or task_options.noprogress:
callback = None
else:
callback = _progress_callback
# We do some early sanity checking of the given target.
# Kojid gets these values again later on, but we check now as a convenience
# for the user.
target = args[0]
tmp_target = session.getBuildTarget(target)
if not tmp_target:
parser.error(_("Unknown build target: %s" % target))
dest_tag = session.getTag(tmp_target['dest_tag'])
if not dest_tag:
parser.error(_("Unknown destination tag: %s" %
tmp_target['dest_tag_name']))
# Set the architecture
arch = koji.canonArch(args[1])
# Upload the KS file to the staging area.
# If it's a URL, it's kojid's job to go get it when it does the checkout.
ksfile = args[2]
if not task_options.ksurl:
serverdir = _unique_path('cli-livecd')
session.uploadWrapper(ksfile, serverdir, callback=callback)
ksfile = os.path.join(serverdir, os.path.basename(ksfile))
print
livecd_opts = {}
for opt in ['scratch', 'ksurl', 'ksversion', '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,
priority=priority)
print "Created task:", task_id
print "Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)
if _running_in_bg() or task_options.nowait:
return
else:
session.logout()
return watch_tasks(session,[task_id])
def handle_free_task(options, session, args):
"[admin] Free a task"
usage = _("usage: %prog free-task [options] <task-id> [<task-id> ...]")