Skip to content

Commit

Permalink
tests: apply updates.img with mkksiso script instead of inst.updates
Browse files Browse the repository at this point in the history
In the meantime remove conditions for ELN to simplify the change,
as we don't run test there anymore and the condition is anyhow obsolete.
  • Loading branch information
KKoukiou committed Oct 4, 2024
1 parent 1046f5d commit 6b49de1
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions test/machine_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,30 @@ def start(self):
if not os.path.exists(update_img_file):
raise FileNotFoundError("Missing updates.img file")

self.http_updates_img_port = self._serve_updates_img()

self.payload_path = os.path.join(BOTS_DIR, "./images/fedora-rawhide-anaconda-payload")
if not os.path.exists(self.payload_path):
raise FileNotFoundError(f"Missing payload file {self.payload_path}; use 'make payload'.")


iso_path = f"{os.getcwd()}/bots/images/{self.image}"
extra_args = ""
if self.is_live():
# Live install ISO has different directory structure inside
iso_path = f"{os.getcwd()}/bots/images/{self.image}"

# Live install ISO has different directory structure ishsnside
# that doesn't follow the standard distribution tree directory structure.
location = f"{iso_path},kernel=images/pxeboot/vmlinuz,initrd=images/pxeboot/initrd.img"

# Live install ISO will not start automatically without providing correct
# kernel arguments to load the LiveOS/squashfs.img file as that's where everything is stored.
volume_id = self.get_volume_id(iso_path)
volume_id = self.get_volume_id(self.iso_path)
extra_args = f"root=live:CDLABEL={volume_id} rd.live.image quiet rhgb"
elif self.is_eln():
# FIXME: Remove this once https://gitlab.com/libosinfo/osinfo-db/-/merge_requests/674 is released
# and version is present in the task container
location = f"{iso_path},kernel=images/pxeboot/vmlinuz,initrd=images/pxeboot/initrd.img"

self.http_updates_img_port = self._serve_updates_img()

else:
location = f"{iso_path}"
self.iso_path = f"{os.getcwd()}/test/images/{self.label}.iso"
self._execute(f"mkksiso --skip-mkefiboot -u {update_img_file} bots/images/fedora-rawhide-boot {self.iso_path}")

location = f"{self.iso_path}"

if self.efi:
boot_arg = "--boot uefi "
Expand All @@ -135,8 +135,7 @@ def start(self):
"--memory 4096 "
"--noautoconsole "
f"--graphics vnc,listen={self.ssh_address} "
"--extra-args "
f"'inst.sshd inst.webui.remote inst.webui inst.updates=http://10.0.2.2:{self.http_updates_img_port}/updates.img' "
"--extra-args \'inst.sshd inst.webui.remote inst.webui\' "
"--network none "
f"--qemu-commandline="
"'-netdev user,id=hostnet0,"
Expand Down Expand Up @@ -182,6 +181,10 @@ def kill(self):
if self.http_payload_server:
self.http_payload_server.kill()

# Delete the generated ISO
if self.iso_path:
self._execute(f"rm -f {self._iso_path}")

# pylint: disable=arguments-differ # this fails locally if you have bots checked out
def wait_poweroff(self):
for _ in range(10):
Expand All @@ -197,11 +200,10 @@ def wait_poweroff(self):
def is_live(self):
return "live" in self.image

def is_eln(self):
return "eln" in self.image

def get_volume_id(self, iso_path):
return subprocess.check_output(fr"isoinfo -d -i {iso_path} | grep -oP 'Volume id: \K.*'", shell=True).decode(sys.stdout.encoding).strip()
return subprocess.check_output(
fr"isoinfo -d -i {self.iso_path} | grep -oP 'Volume id: \K.*'", shell=True
).decode(sys.stdout.encoding).strip()


class VirtInstallEFIMachine(VirtInstallMachine):
Expand Down

0 comments on commit 6b49de1

Please sign in to comment.