[virt-install PATCH v2 07/14] osdict: Add set_install_script_installation_source()

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

 



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

diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index b348844c..b9387a33 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -563,6 +563,24 @@ 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."))
+
+        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):
-- 
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