virt-install: Drop install option collision errors

It's getting hard to track this correctly with the addition of
--install. Drop it. The important thing is validating when no install
options were specified
This commit is contained in:
Cole Robinson 2019-06-13 14:13:29 -04:00
parent c5bbf2f48d
commit 3cc42c2f24
1 changed files with 3 additions and 25 deletions

View File

@ -22,16 +22,7 @@ from virtinst.cli import fail, print_stdout, print_stderr
# Validation utility helpers # # Validation utility helpers #
############################## ##############################
install_methods = "--location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|..." INSTALL_METHODS = "--location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|..."
def all_install_options(options):
return [options.pxe, options.cdrom, options.location,
options.import_install]
def install_specified(options):
return any([bool(o) for o in all_install_options(options)])
def supports_pxe(guest): def supports_pxe(guest):
@ -331,7 +322,7 @@ def validate_required_options(options, guest, installer):
if not installer: if not installer:
msg += "\n" + ( msg += "\n" + (
_("An install method must be specified\n(%(methods)s)") % _("An install method must be specified\n(%(methods)s)") %
{"methods": install_methods}) {"methods": INSTALL_METHODS})
if msg: if msg:
fail(msg) fail(msg)
@ -341,17 +332,6 @@ _cdrom_location_man_page = _("See the man page for examples of "
"using --location with CDROM media") "using --location with CDROM media")
def check_option_collisions(options, guest):
# Install collisions
if sum([bool(l) for l in all_install_options(options)]) > 1:
fail(_("Only one install method can be used (%(methods)s)") %
{"methods": install_methods})
if guest.os.is_container() and install_specified(options):
fail(_("Install methods (%s) cannot be specified for "
"container guests") % install_methods)
def _show_nographics_warnings(options, guest, installer): def _show_nographics_warnings(options, guest, installer):
if guest.devices.graphics: if guest.devices.graphics:
return return
@ -585,7 +565,6 @@ def build_guest_instance(conn, options):
cli.validate_disk(disk) cli.validate_disk(disk)
validate_required_options(options, guest, installer) validate_required_options(options, guest, installer)
check_option_collisions(options, guest)
show_warnings(options, guest, installer) show_warnings(options, guest, installer)
return guest, installer return guest, installer
@ -941,6 +920,7 @@ def set_test_stub_options(options): # pragma: no cover
if not options.test_stub_command: if not options.test_stub_command:
return return
options.import_install = True
if not options.connect: if not options.connect:
options.connect = "test:///default" options.connect = "test:///default"
if not options.name: if not options.name:
@ -949,8 +929,6 @@ def set_test_stub_options(options): # pragma: no cover
options.memory = "256" options.memory = "256"
if not options.disk: if not options.disk:
options.disk = "none" options.disk = "none"
if not install_specified(options):
options.import_install = True
if not options.graphics: if not options.graphics:
options.graphics = "none" options.graphics = "none"
if not options.os_variant: if not options.os_variant: