mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
guest: Tweak error with invalid --os-variant
Try to point people in the right direction if they specify an unknown distro name on the cli, like was reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1576473
This commit is contained in:
parent
046a242bd4
commit
b51104ad22
@ -304,20 +304,21 @@ def convert_old_features(options):
|
||||
##################################
|
||||
|
||||
def set_distro_variant(options, guest, installer):
|
||||
distro = None
|
||||
try:
|
||||
installer.check_location(guest)
|
||||
|
||||
distro = None
|
||||
if options.distro_variant == "auto":
|
||||
distro = installer.detect_distro(guest)
|
||||
elif options.distro_variant != "none":
|
||||
distro = options.distro_variant
|
||||
|
||||
if distro:
|
||||
guest.set_os_name(distro)
|
||||
except ValueError as e:
|
||||
fail(_("Error validating install location: %s") % str(e))
|
||||
|
||||
if distro:
|
||||
guest.set_os_name(distro)
|
||||
|
||||
|
||||
def do_test_media_detection(conn, options):
|
||||
url = options.test_media_detection
|
||||
|
@ -259,8 +259,8 @@ class Guest(XMLBuilder):
|
||||
def set_os_name(self, name):
|
||||
obj = OSDB.lookup_os(name)
|
||||
if obj is None:
|
||||
raise ValueError(
|
||||
_("Distro '%s' does not exist in our dictionary") % name)
|
||||
raise ValueError(_("Unknown OS name '%s'. "
|
||||
"See `osinfo-query os` for valid values.") % name)
|
||||
|
||||
logging.debug("Setting Guest osinfo %s", obj)
|
||||
self.__osinfo = obj
|
||||
|
Loading…
Reference in New Issue
Block a user