osdict: Deal with medias' installer scripts

As medias may also have installer scripts associates to themselves and,
in this case, those should be considered instead the OS ones.

More than that, Libosinfo.Media provides an API that tells whether that
specific media supports installer scripts or not and this must be
checked as the first thing. In case no installer script is supported,
let's just error out and abort the installation.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2019-03-07 13:52:57 +01:00 committed by Cole Robinson
parent 93d3223c87
commit db6161c610
1 changed files with 22 additions and 0 deletions

View File

@ -564,6 +564,28 @@ class _OsVariant(object):
return installscripts[0]
script_list = []
# In case we're dealing with a media installation, let's try to get
# the installer scripts from the media, in case any is set.
if media:
if not media.supports_installer_script():
raise RuntimeError(
_("'%s' used media does not support unattended "
"installation") % (self.name))
script_list = list(_OsinfoIter(media.get_install_script_list()))
# In case some script is set, but not one matching the specified
# profile, let's just error out as trying to use the OS' installer
# is too much error prone.
# However, if no script is found, let's just follow with the
# current code path and get the script from the installer, as some
# OSes only have the installer scripts set to the Libosinfo.Os
# itself.
if script_list:
installscript = _get_install_script(script_list)
return installscript
if self._os:
script_list = list(_OsinfoIter(self._os.get_install_script_list()))