unattended: Use generate_*_for_media when possible

Let's use generate_for_media() generate_command_line_for_media() methods
whenever it's possible.

This method, differently from generate() and generate_command_line(),
will take an OsinfoMedia as parameter and will use its info in order to
better decide how to properly generate the install-script and the kernel
command-line.

It's important to mention that those APIs were released as part of
libosinfo v0.2.12, from May 26th, 2015. Knowing it's out for 4+ years
from the moment of this comment, I'm taken the path as not checking
whether the libosinfo used has this API or not.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2019-07-12 15:02:22 +02:00 committed by Cole Robinson
parent a3b9d6ffc4
commit e775dd09f6

View File

@ -180,9 +180,17 @@ class OSInstallScript:
self._config = config
def generate(self):
if self._osinfomediaobj:
return self._script.generate_for_media(
self._osinfomediaobj, self._config)
return self._script.generate(self._osobj.get_handle(), self._config)
def generate_cmdline(self):
if self._osinfomediaobj:
return self._script.generate_command_line_for_media(
self._osinfomediaobj, self._config)
return self._script.generate_command_line(
self._osobj.get_handle(), self._config)