[virt-manager PATCH v3 8/9] osdict: Deal with medias' installer scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 virtinst/osdict.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 0ef1617c..08176976 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -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()))
 
-- 
2.20.1

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux