|
| 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