[libvirt] [jenkins-ci PATCH 02/22] guests, lcitool: Use install_url in the unattended install files

Fabiano Fidêncio posted 22 patches 4 years, 11 months ago
There is a newer version of this series
[libvirt] [jenkins-ci PATCH 02/22] guests, lcitool: Use install_url in the unattended install files
Posted by Fabiano Fidêncio 4 years, 11 months ago
Passing `url --url={{ install_url }}` to a kickstart file is, according
to Red Hat official documentation[0], mandatory for RHEL 8 and onwards
(which includes CentOS 8).

Using it for RHEL 7, CentOS 7, and Fedora does not cause any issue.

[0]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/performing_an_advanced_rhel_installation/kickstart-commands-and-options-reference_installing-rhel-as-an-experienced-user

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
---
 guests/configs/kickstart.cfg |  4 ++++
 guests/lcitool               | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/guests/configs/kickstart.cfg b/guests/configs/kickstart.cfg
index 713557a..a176e25 100644
--- a/guests/configs/kickstart.cfg
+++ b/guests/configs/kickstart.cfg
@@ -44,6 +44,10 @@ part swap --fstype=swap --size=256
 bootloader --location=mbr --timeout=1
 
 
+# Set the installation url
+url --url={{ install_url }}
+
+
 # Configure networking
 #
 # The only network interface available to the guest will come up
diff --git a/guests/lcitool b/guests/lcitool
index 3985e90..9ef5795 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -539,9 +539,19 @@ class Application:
                 raise Exception(
                     "Host {} doesn't support installation".format(host)
                 )
+
+            unattended_options = [
+                "install_url",
+            ]
+
             initrd_template = os.path.join(base, "configs", install_config)
             with open(initrd_template) as template:
                 content = template.read()
+                for option in unattended_options:
+                    content = content.replace(
+                        "{{ " + option + " }}",
+                        facts[option]
+                    )
 
                 tempdir = tempfile.mkdtemp()
                 initrd_inject = os.path.join(tempdir, install_config)
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 02/22] guests, lcitool: Use install_url in the unattended install files
Posted by Andrea Bolognani 4 years, 11 months ago
On Mon, 2019-12-09 at 16:20 +0100, Fabiano Fidêncio wrote:
> guests,lcitool: Use install_url in the unattended install files

s/^guests,//

> +++ b/guests/configs/kickstart.cfg
> +# Set the installation url
> +url --url={{ install_url }}

I know it doesn't make any difference in practice, but setting this
up right in between configuring the bootloader and the network is
a... rather peculiar choice.

Please move this to the very top of the file, and include a proper
comment for it like

  # Installation source
  #
  # The operating system will be installed from the following URL


Everything else looks good, so with these nits fixed

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list