Skip to content

Commit

Permalink
Merge pull request #12858 from ggbecker/improve-osinfo-detection-inst…
Browse files Browse the repository at this point in the history
…all_vm

install_vm: Add default osinfo for RHEL distro
  • Loading branch information
Mab879 authored Jan 28, 2025
2 parents b132c75 + ebec638 commit 7e1da05
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/install_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
"centos9",
"rhel8",
"rhel9",
"rhel10",
]

# put here any unreleased distro in development that needs to be tested
# and any working osinfo known to be used by default when installating it
UNRELEASED_DISTROS_AND_OSINFO = {
"rhel10": "rhel9-unknown"
}

DISTRO_URL = {
"fedora":
"https://download.fedoraproject.org/pub/fedora/linux/releases/41/Everything/x86_64/os",
Expand All @@ -34,8 +39,14 @@ def path_from_tests(path):


def parse_args():
import textwrap
osinfo_epilog = textwrap.dedent(r"""
--osinfo details: 'For unreleased distros, these are the following
default data used as input {}.
""".format(UNRELEASED_DISTROS_AND_OSINFO))
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
formatter_class=argparse.RawTextHelpFormatter,
epilog=osinfo_epilog,
)

parser.add_argument(
Expand All @@ -54,7 +65,7 @@ def parse_args():
"--distro",
dest="distro",
required=True,
choices=KNOWN_DISTROS,
choices=KNOWN_DISTROS + list(UNRELEASED_DISTROS_AND_OSINFO.keys()),
help="What distribution to install.",
)
parser.add_argument(
Expand Down Expand Up @@ -327,6 +338,10 @@ def get_virt_install_command(data):

if data.osinfo:
command.append(f'--osinfo={data.osinfo}')
else:
if data.distro in UNRELEASED_DISTROS_AND_OSINFO.keys():
command.append("--osinfo={}".format(
UNRELEASED_DISTROS_AND_OSINFO.get(data.distro, "rhel9-unknown")))

command.extend(join_extented_opt("--boot", ",", boot_opts))
command.extend(join_extented_opt("--extra-args", " ", extra_args_opts))
Expand Down

0 comments on commit 7e1da05

Please sign in to comment.