Let's use generate_for_tree() and generate_command_line_for_tree() methods whenever it's possible. This method, similarly to generate_for_media() and generate_command_line_for_media() will take an OsinfoTree as parameter and will use its info in order to better decide how to properly generate the install-script and kernel command-line. It's important to mention that those APIs are part of libosinfo v1.6.0 release and that's the reason the check for them has been added. Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> --- virtinst/install/unattended.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/virtinst/install/unattended.py b/virtinst/install/unattended.py index f32e60a4..35b61451 100644 --- a/virtinst/install/unattended.py +++ b/virtinst/install/unattended.py @@ -125,10 +125,11 @@ class OSInstallScript: return True return False # pragma: no cover - def __init__(self, script, osobj, osinfomediaobj): + def __init__(self, script, osobj, osinfomediaobj, osinfotreeobj): self._script = script self._osobj = osobj self._osinfomediaobj = osinfomediaobj + self._osinfotreeobj = osinfotreeobj self._config = None if not OSInstallScript.have_new_libosinfo(): # pragma: no cover @@ -183,6 +184,11 @@ class OSInstallScript: if self._osinfomediaobj: return self._script.generate_for_media( self._osinfomediaobj, self._config) + if hasattr(self._script, "generate_for_tree") and self._osinfotreeobj: + # osinfo_install_script_generate_for_tree() is part of + # libosinfo 1.6.0 + return self._script.generate_for_tree( + self._osinfotreeobj, self._config) return self._script.generate(self._osobj.get_handle(), self._config) @@ -190,7 +196,12 @@ class OSInstallScript: if self._osinfomediaobj: return self._script.generate_command_line_for_media( self._osinfomediaobj, self._config) - + if (hasattr(self._script, "generate_command_line_for_tree") and + self._osinfotreeobj): + # osinfo_install_script_generate_command_line_for_tree() is part of + # libosinfo 1.6.0 + return self._script.generate_command_line_for_tree( + self._osinfotreeobj, self._config) return self._script.generate_command_line( self._osobj.get_handle(), self._config) @@ -323,7 +334,9 @@ def prepare_install_script(guest, unattended_data, unattended_data.profile, os_media) osinfomediaobj = os_media.get_osinfo_media() if os_media else None - script = OSInstallScript(rawscript, guest.osinfo, osinfomediaobj) + osinfotreeobj = os_tree.get_osinfo_tree() if os_tree else None + script = OSInstallScript( + rawscript, guest.osinfo, osinfomediaobj, osinfotreeobj) script.set_preferred_injection_method(injection_method) -- 2.21.0 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list