[virt-tools-list] [virt-manager PATCH 4/5] unattended: Use generate_*_for_media when possible

Fabiano Fidêncio fidencio at redhat.com
Fri Jul 12 13:02:22 UTC 2019


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.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 virtinst/install/unattended.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/virtinst/install/unattended.py b/virtinst/install/unattended.py
index 98bcbb21..e34b8ae2 100644
--- a/virtinst/install/unattended.py
+++ b/virtinst/install/unattended.py
@@ -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)
 
-- 
2.21.0




More information about the virt-tools-list mailing list