Optparsing for LMC

Initial LMC optparsing post for koji cli, and probably needs improvement as
backside arguments are fleshed out. Code taken iand modified slightly
from handle_spin_appliance() by Jay Greguski.

Signed-off-by: Jon Disnard <jdisnard@redhat.com>
This commit is contained in:
Jon Disnard 2015-10-15 15:11:42 -05:00 committed by Mike McLean
parent 514d4e4f7c
commit 622e22d22f

View file

@ -5218,6 +5218,60 @@ def handle_spin_livecd(options, session, args):
assert False
_build_image(options, task_options, session, args, 'livecd')
# This handler is for spinning livemedia images
def handle_spin_livemedia(options, session, args):
"""[admin] Create a livemedia image given a kickstart file"""
# Usage & option parsing.
usage = _("usage: %prog spin-livemedia [options] <name> <version> <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("--wait", action="store_true",
help=_("Wait on the livemedia creation, even if running in the background"))
parser.add_option("--nowait", action="store_false", dest="wait",
help=_("Don't wait on livemedia 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 livemedia creation task at a lower priority"))
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 LiveMEDIA image"))
parser.add_option("--repo", action="append",
help=_("Specify a repo that will override the repo used to install " +
"RPMs in the LiveMEDIA. May be used multiple times. The " +
"build tag repo associated with the target is the default."))
parser.add_option("--release", help=_("Forcibly set the release field"))
parser.add_option("--specfile", metavar="URL",
help=_("SCM URL to spec file fragment to use to generate wrapper RPMs"))
parser.add_option("--skip-tag", action="store_true",
help=_("Do not attempt to tag package"))
(task_options, args) = parser.parse_args(args)
# LMC operations
parser.add_option("--disk-img", action="store_true",
help=_("Spin bootable disk media"))
parser.add_option("--live-ostree-pxe", action="store_true",
help=_("Spin live ostree PXE media"))
parser.add_option("--live-iso", action="store_true",
help=_("Spin live ISO media"))
# Make sure the target and kickstart is specified.
if len(args) != 5:
parser.error(_("Five arguments are required: a name, a version, an" +
" architecture, a build target, and a relative path to" +
" a kickstart file."))
assert False
_build_image(options, task_options, session, args, 'livemedia')
# This handler is for spinning appliance images
#
def handle_spin_appliance(options, session, args):