Skip to content

Commit 2485e8f

Browse files
committed
Add 5.2 support on JSON Generator
1 parent 56f1210 commit 2485e8f

6 files changed

Lines changed: 82 additions & 8 deletions

File tree

jenkins_pipelines/scripts/json_generator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ README files for each script:
66
## Scripts
77

88
- [maintenance_json_generator script README](./maintenance_json_generator_README.md) - Automates gathering and
9-
processing of open QAM SLE requests that affect SUMA 4.3 and 5.0 and generates JSON output for BV testsuite
9+
processing of open QAM SLE requests that affect SUMA 4.3, 5.0, 5.1, and 5.2 and generates JSON output for BV testsuite
1010
- [ibs_osc_client_README](./ibs_osc_client_README.md) - checks embargo status and processes repository information
1111
- [smash_client_README](./smash_client_README.md) - interacts with SUSE Manager's SMASH API to retrieve and manage embargoed bug IDs and CVEs.
1212

jenkins_pipelines/scripts/json_generator/ibs_osc_client_README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ performs the following tasks:
3030
details about MIs and their associated repositories.
3131

3232
The output is a JSON file, which can be used for further testing in the BV
33-
(Business Validation) testsuite pipeline. The script supports both SUSE Manager
33+
(Build Validation) testsuite pipeline. The script supports both SUSE Manager
3434
4.3 (SUMA 4.3) and SUSE Manager 5.0 (SUMA 5.0).
3535

3636
## Features

jenkins_pipelines/scripts/json_generator/maintenance_json_generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def parse_cli_args() -> argparse.Namespace:
1818
description="This script reads the open qam-manager requests and creates a json file that can be fed to the BV testsuite pipeline"
1919
)
2020
parser.add_argument("-v", "--version", dest="version",
21-
help="Version of SUMA you want to run this script for, the options are 43 for 4.3, 50 for 5.0, and 51 for 5.1",
22-
choices=["43", "50-micro", "50-sles", "51-micro","51-sles"], default="43", action='store')
21+
help="Version of SUMA you want to run this script for, the options are 43 for 4.3, 50 for 5.0, 51 for 5.1, and 52 for 5.2",
22+
choices=["43", "50-micro", "50-sles", "51-micro","51-sles", "52-micro", "52-sles"], default="43", action='store')
2323
parser.add_argument("-i", "--mi_ids", required=False, dest="mi_ids", help="Space separated list of MI IDs", nargs='*', action='store')
2424
parser.add_argument("-f", "--file", required=False, dest="file", help="Path to a file containing MI IDs separated by newline character", action='store')
2525
parser.add_argument("-e", "--no_embargo", dest="embargo_check", help="Reject MIs under embargo", action='store_true')
@@ -73,7 +73,7 @@ def get_version_nodes(version: str):
7373

7474
def init_custom_repositories(version: str, static_repos: dict[str, dict[str, str]] = None) -> dict[str, dict[str, str]]:
7575
custom_repositories: dict[str, dict[str, str]] = {}
76-
if version.startswith("51") and static_repos:
76+
if (version.startswith("51") or version.startswith("52")) and static_repos:
7777
for node, named_urls in static_repos.items():
7878
custom_repositories[node] = {
7979
name: f"{IBS_MAINTENANCE_URL_PREFIX}{url}" if not url.startswith("http") else url

jenkins_pipelines/scripts/json_generator/maintenance_json_generator_README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
This Python script automates the process of gathering and processing open QAM
2020
(Quality Assurance Maintenance) requests for SUSE Linux Enterprise Server (SLES)
2121
that affect SUSE Manager. The output is a JSON file, which can be fed into the
22-
BV (Business Validation) testsuite pipeline for further testing. It supports
22+
BV (Build Validation) testsuite pipeline for further testing. It supports
2323
both SUSE Manager 4.3 (SUMA 4.3) and SUSE Manager 5.0 (SUMA 5.0).
2424

2525
The script allows users to input Maintenance Incident (MI) IDs and generates the
@@ -51,7 +51,7 @@ python3.11 maintenance_json_generator.py [options]
5151
Options:
5252

5353
`-v`, `--version`: Specifies the SUSE Manager version. Options are `43` for SUSE
54-
Manager 4.3 and `50` for SUSE Manager 5.0. Default is 43.
54+
Manager 4.3, `50-micro` / `50-sles` for 5.0, `51-micro` / `51-sles` for 5.1, and `52-micro` / `52-sles` for 5.2. Default is 43.
5555
`-i`, `--mi_ids`: A space-separated list of MI IDs.
5656
`-f`, `--file`: Path to a file containing MI IDs, each on a new line.
5757
`-e`, `--no_embargo`: Reject any MIs that are currently under embargo.
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
from .v43_nodes import get_v43_nodes_sorted
22
from .v50_nodes import get_v50_nodes_sorted
33
from .v51_nodes import get_v51_static_and_client_tools
4+
from .v52_nodes import get_v52_static_and_client_tools
45

56
static_51_micro, dynamic_51_micro = get_v51_static_and_client_tools("micro")
67
static_51_sles, dynamic_51_sles = get_v51_static_and_client_tools("sles")
78

9+
static_52_micro, dynamic_52_micro = get_v52_static_and_client_tools("micro")
10+
static_52_sles, dynamic_52_sles = get_v52_static_and_client_tools("sles")
11+
812
nodes_by_version: dict[str, dict[str, dict[str, list[str]]]] = {
913
"43": {"dynamic": get_v43_nodes_sorted()},
1014
"50-micro": {"dynamic": get_v50_nodes_sorted(get_v43_nodes_sorted(), "micro")},
1115
"50-sles": {"dynamic": get_v50_nodes_sorted(get_v43_nodes_sorted(), "sles")},
1216
"51-sles": {"static": static_51_sles, "dynamic": dynamic_51_sles},
13-
"51-micro": {"static": static_51_micro, "dynamic": dynamic_51_micro}
17+
"51-micro": {"static": static_51_micro, "dynamic": dynamic_51_micro},
18+
"52-sles": {"static": static_52_sles, "dynamic": dynamic_52_sles},
19+
"52-micro": {"static": static_52_micro, "dynamic": dynamic_52_micro}
1420
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
from typing import Dict, Set, List
2+
3+
# Import the shared client tools from 5.1
4+
from .v51_nodes import (
5+
v51_nodes_static_client_tools_repositories,
6+
v51_nodes_dynamic_client_tools_repos,
7+
IBS_URL_PREFIX
8+
)
9+
10+
# Define 5.2 specific Server and Proxy repositories (using 15-SP7)
11+
v52_uyuni_tools_sles_repos: Dict[str, Set[str]] = {
12+
"server" : {"/SUSE_Updates_Multi-Linux-Manager-Server-SLE_5.2_x86_64/",
13+
"/SUSE_Updates_SLE-Module-Server-Applications_15-SP7_x86_64/",
14+
"/SUSE_Updates_SLE-Module-Basesystem_15-SP7_x86_64/",
15+
"/SUSE_Updates_SLE-Module-Containers_15-SP7_x86_64/",
16+
"/SUSE_Updates_SLE-Module-Python3_15-SP7_x86_64/"},
17+
"proxy" : { "/SUSE_Updates_Multi-Linux-Manager-Proxy-SLE_5.2_x86_64/",
18+
"/SUSE_Updates_Multi-Linux-Manager-Retail-Branch-Server-SLE_5.2_x86_64/",
19+
"/SUSE_Updates_MultiLinuxManagerTools_SLE-15_x86_64/",
20+
"/SUSE_Updates_SLE-Module-Server-Applications_15-SP7_x86_64/",
21+
"/SUSE_Updates_SLE-Module-Basesystem_15-SP7_x86_64/",
22+
"/SUSE_Updates_SLE-Module-Containers_15-SP7_x86_64/",
23+
"/SUSE_Updates_SLE-Module-Python3_15-SP7_x86_64/"},
24+
}
25+
26+
v52_uyuni_tools_micro_repos: Dict[str, Dict[str, str]] = {
27+
"server": {
28+
"server_uyuni_tools": "/SLFO:/Products:/Multi-Linux-Manager:/5.2:/ToTest/product/repo/Multi-Linux-Manager-Server-5.2-x86_64/"},
29+
"proxy": {
30+
"proxy_uyuni_tools": "/SLFO:/Products:/Multi-Linux-Manager:/5.2:/ToTest/product/repo/Multi-Linux-Manager-Proxy-5.2-x86_64/",
31+
"retail_uyuni_tools": "/SLFO:/Products:/Multi-Linux-Manager:/5.2:/ToTest/product/repo/Multi-Linux-Manager-Retail-Branch-Server-5.2-x86_64/",
32+
"slmicro6_client_tools": "/SLFO:/Products:/MultiLinuxManagerTools:/SL-Micro-6:/ToTest/product/repo/Multi-Linux-ManagerTools-SL-Micro-6-x86_64/"
33+
}
34+
}
35+
36+
def get_v52_static_and_client_tools(variant: str = "micro") -> (Dict[str, Dict[str, str]], Dict[str, List[str]]):
37+
# 1. Initialize static repositories using the shared 5.1 client tools
38+
static_repos: Dict[str, Dict[str, str]] = {
39+
key: {name: f"{IBS_URL_PREFIX}{path}" for name, path in subdict.items()}
40+
for key, subdict in v51_nodes_static_client_tools_repositories.items()
41+
}
42+
43+
# 2. Initialize dynamic repositories using the shared 5.1 client tools
44+
dynamic_maintenance_repos: Dict[str, Set[str]] = {
45+
key: set(paths) for key, paths in v51_nodes_dynamic_client_tools_repos.items()
46+
}
47+
48+
# 3. Select 5.2 Uyuni tools based on variant and merge
49+
if variant == "micro":
50+
uyuni_tools = v52_uyuni_tools_micro_repos
51+
for key in ("server", "proxy"):
52+
if key not in static_repos:
53+
static_repos[key] = {}
54+
for name, path in uyuni_tools.get(key, {}).items():
55+
static_repos[key][name] = f"{IBS_URL_PREFIX}{path}"
56+
57+
elif variant == "sles":
58+
uyuni_tools = v52_uyuni_tools_sles_repos
59+
for key in ("server", "proxy"):
60+
if key not in dynamic_maintenance_repos:
61+
dynamic_maintenance_repos[key] = set()
62+
for path in uyuni_tools.get(key, set()):
63+
dynamic_maintenance_repos[key].add(path)
64+
65+
else:
66+
raise ValueError(f"Invalid variant '{variant}'. Choose from: 'micro', 'sles'")
67+
68+
return static_repos, dynamic_maintenance_repos

0 commit comments

Comments
 (0)