osdict: Add set_install_script_installation_source()

As some of the install scripts may act differently depending on whether
the installation is going to be done via the OS media or via network
let's have a wrapper around set_installation_source(), from
Libosinfo.InstallScript, in order to be able to properly set which is
going to be the used installation source.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2019-02-22 09:40:14 +01:00 committed by Cole Robinson
parent 68640f3401
commit 72d93ee7d8

View File

@ -563,6 +563,25 @@ class _OsVariant(object):
logging.debug("Using '%s' injection method", method)
script.set_preferred_injection_method(injection_method)
def set_install_script_installation_source(self, script, source):
def nick_to_value(source):
installation_sources = [
libosinfo.InstallScriptInstallationSource.MEDIA,
libosinfo.InstallScriptInstallationSource.NETWORK]
for s in installation_sources:
if source == s.value_nick:
return s
raise RuntimeError(
_("%s is a non-valid installation source in libosinfo.") %
source)
installation_source = nick_to_value(source)
logging.debug("Using '%s' installation source", source)
script.set_installation_source(installation_source)
def get_install_script_config(self, script, unattended_data, arch,
hostname):
def requires_param(config_param):