[virt-tools-list] [virt-manager PATCH v3 1/9] installertreemdia: Set user specified --location as the installer URL

Fabiano Fidêncio fidencio at redhat.com
Thu Mar 7 12:52:50 UTC 2019


The location has to be passed down to the generate_install_script()
method whenever a tree based installation is being performed.

Although Libosinfo provides information about the URL to be used when
performing a tree based installation, cases where the users prefer to
use, for any specific reason, their own URLs should be covered as well.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 virtinst/installertreemedia.py |  3 ++-
 virtinst/unattended.py         | 10 +++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/virtinst/installertreemedia.py b/virtinst/installertreemedia.py
index 6167086c..ab2f67eb 100644
--- a/virtinst/installertreemedia.py
+++ b/virtinst/installertreemedia.py
@@ -175,8 +175,9 @@ class InstallerTreeMedia(object):
     def prepare(self, guest, meter):
         cmdline = None
         if self._unattended_data:
+            location = self.location if self._media_type == MEDIA_URL else None
             script = unattended.prepare_install_script(
-                    guest, self._unattended_data)
+                    guest, self._unattended_data, location)
             path, cmdline = unattended.generate_install_script(script)
 
             logging.debug("Generated unattended cmdline: %s", cmdline)
diff --git a/virtinst/unattended.py b/virtinst/unattended.py
index 0f3fd096..6d67b210 100644
--- a/virtinst/unattended.py
+++ b/virtinst/unattended.py
@@ -18,7 +18,7 @@ from gi.repository import GLib
 from . import util
 
 
-def _make_installconfig(script, osobj, unattended_data, arch, hostname):
+def _make_installconfig(script, osobj, unattended_data, arch, hostname, url):
     """
     Build a Libosinfo.InstallConfig instance
     """
@@ -111,6 +111,9 @@ def _make_installconfig(script, osobj, unattended_data, arch, hostname):
             _("'en_US' will be used as both language and keyboard layout "
               "for unattended installation."))
 
+    if url:
+        config.set_installation_url(url)
+
     logging.debug("InstallScriptConfig created with the following params:")
     logging.debug("username: %s", config.get_user_login())
     logging.debug("realname: %s", config.get_user_realname())
@@ -122,6 +125,7 @@ def _make_installconfig(script, osobj, unattended_data, arch, hostname):
     logging.debug("timezone: %s", config.get_l10n_timezone())
     logging.debug("language: %s", config.get_l10n_language())
     logging.debug("keyboard: %s", config.get_l10n_keyboard())
+    logging.debug("url: %s", config.get_installation_url())
 
     return config
 
@@ -224,7 +228,7 @@ class UnattendedData():
     user_password = None
 
 
-def prepare_install_script(guest, unattended_data):
+def prepare_install_script(guest, unattended_data, url=None):
     rawscript = guest.osinfo.get_install_script(unattended_data.profile)
     script = OSInstallScript(rawscript, guest.osinfo)
 
@@ -234,7 +238,7 @@ def prepare_install_script(guest, unattended_data):
     script.set_installation_source("network")
 
     config = _make_installconfig(script, guest.osinfo, unattended_data,
-            guest.os.arch, guest.name)
+            guest.os.arch, guest.name, url)
     script.set_config(config)
     return script
 
-- 
2.20.1




More information about the virt-tools-list mailing list