osdict: Raise exception on get_location failure

It's better to error immediately if we know this won't work
This commit is contained in:
Cole Robinson
2019-02-18 10:56:38 -05:00
parent 5f7d49d6a3
commit 8139b3839e
2 changed files with 7 additions and 13 deletions

View File

@ -444,12 +444,8 @@ def build_installer(options, guest):
if options.os_variant.install == "location":
if not options.location:
location = guest.osinfo.get_location(guest.os.arch)
if not location:
logging.debug(_("No location could be guessed from osinfo-db "
"and the installation cannot proceed"))
# This triggers an error in validate_required_options
return None
logging.debug("Generated default libosinfo '--location %s'", location)
logging.debug(
"Generated default libosinfo '--location %s'", location)
options.location = location
elif options.os_variant.install == "cdrom":
pass

View File

@ -486,16 +486,14 @@ class _OsVariant(object):
treelist = self._os.get_tree_list()
if treelist.get_length() < 1:
logging.error(
_("%s does not have a URL location"), self.name)
return None
raise RuntimeError(
_("%s does not have a URL location") % self.name)
filtered_treelist = treelist.new_filtered(treefilter)
if filtered_treelist.get_length() < 1:
logging.error(
_("%s does not have a URL location for the %s architecture"),
self.name, arch)
return None
raise RuntimeError(
_("%s does not have a URL location for the %s architecture") %
(self.name, arch))
# Some distros have more than one URL for a specific architecture,
# which is the case for Fedora and different variants (Server,