unattended: Handle libosinfo returning kernel url arg

Latest libosinfo will handle this. Check for it so we don't end up
with double options on the command line
This commit is contained in:
Cole Robinson 2019-06-08 13:01:43 -04:00
parent 95d685420b
commit 08baf0ee5f
2 changed files with 13 additions and 6 deletions

View File

@ -13,7 +13,7 @@
<type arch="x86_64" machine="q35">hvm</type>
<kernel>/TESTSUITE_KERNEL_PATH</kernel>
<initrd>/TESTSUITE_INITRD_PATH</initrd>
<cmdline>ks=file:/fedora.ks method=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Server/x86_64/os/</cmdline>
<cmdline>ks=file:/fedora.ks inst.repo=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Server/x86_64/os/</cmdline>
</os>
<features>
<acpi/>

View File

@ -208,7 +208,7 @@ class InstallerTreeMedia(object):
self._unattended_data = unattended_data
def prepare(self, guest, meter):
cmdline = None
unattended_cmdline = None
fetcher = self._get_fetcher(guest, meter)
cache = self._get_cached_data(guest, fetcher)
@ -216,9 +216,11 @@ class InstallerTreeMedia(object):
location = self.location if self._media_type == MEDIA_URL else None
script = unattended.prepare_install_script(
guest, self._unattended_data, location, cache.os_media)
path, cmdline = unattended.generate_install_script(guest, script)
path, unattended_cmdline = unattended.generate_install_script(
guest, script)
logging.debug("Generated unattended cmdline: %s", cmdline)
logging.debug("Generated unattended cmdline: %s",
unattended_cmdline)
logging.debug("Generated unattended script: %s", path)
logging.debug("Generated script contents:\n%s",
open(path).read())
@ -231,8 +233,13 @@ class InstallerTreeMedia(object):
# If a cmdline was set due to unattended installation, prepend the
# unattended kernel cmdline to the args returned by
# _prepare_kernel_url()
if cmdline:
a = "%s %s" % (cmdline, a)
if unattended_cmdline:
if self.location in a and self.location in unattended_cmdline:
# Latest libosinfo will handle the URL arg by itself,
# don't double it up
a = unattended_cmdline
else:
a = "%s %s" % (unattended_cmdline, a)
return k, i, a