From fd21f8fc572ae09a6ab7a9e2c600999c06ba622d Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 17 Nov 2023 16:31:21 +0100 Subject: [PATCH] Adding URL of the RHEL-9 repo server to configuration. --- etc/create-vmware-template.ini.default | 3 +++ lib/cr_vmware_tpl/config/__init__.py | 10 ++++++++++ lib/cr_vmware_tpl/config/eval.py | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/etc/create-vmware-template.ini.default b/etc/create-vmware-template.ini.default index 0118d72..6702d52 100644 --- a/etc/create-vmware-template.ini.default +++ b/etc/create-vmware-template.ini.default @@ -46,6 +46,9 @@ rhsm_user = dpx-subscriber ; The password of the latter user ;rhsm_pwd = +; The complete URL of the RHEL9 repo server +;rhel9_repo_server_url = https://test-repo01.pixelpark.com/Linux/yum/rhel + [Timeouts] ; General timeout in seconds for create_vm, poweron_vm and shutdown_vm diff --git a/lib/cr_vmware_tpl/config/__init__.py b/lib/cr_vmware_tpl/config/__init__.py index b08d157..539fa69 100644 --- a/lib/cr_vmware_tpl/config/__init__.py +++ b/lib/cr_vmware_tpl/config/__init__.py @@ -140,6 +140,7 @@ class CrTplConfiguration(BaseMultiConfig, ConfigCobbler, ConfigTimeouts, ConfigE re_resolv_ns_entry = re.compile(r'^\s*nameserver\s+(\S+)') default_rhsm_user = 'dpx-subscriber' + default_rhel9_repo_server_url = 'https://test-repo01.pixelpark.com/Linux/yum/rhel' # ------------------------------------------------------------------------- def __init__( @@ -217,6 +218,8 @@ class CrTplConfiguration(BaseMultiConfig, ConfigCobbler, ConfigTimeouts, ConfigE self._rhsm_user = self.default_rhsm_user self._rhsm_pwd = None + self._rhel9_repo_server_url = self.default_rhel9_repo_server_url + super(CrTplConfiguration, self).__init__( appname=appname, verbose=verbose, version=version, base_dir=base_dir, append_appname_to_stems=append_appname_to_stems, config_dir=config_dir, @@ -364,6 +367,12 @@ class CrTplConfiguration(BaseMultiConfig, ConfigCobbler, ConfigTimeouts, ConfigE """Flag, that the RPM packages should be installed with documentation and man pages.""" return self._vm_has_docs + # ------------------------------------------------------------------------- + @property + def rhel9_repo_server_url(self): + """The complete URL of the repository server for RHEL-9.""" + return self._rhel9_repo_server_url + # ------------------------------------------------------------------------- def as_dict(self, short=True): """ @@ -387,6 +396,7 @@ class CrTplConfiguration(BaseMultiConfig, ConfigCobbler, ConfigTimeouts, ConfigE res['data_size'] = self.data_size res['default_cobbler_nameservers'] = self.default_cobbler_nameservers res['ram_gb'] = self.ram_gb + res['rhel9_repo_server_url'] = self.rhel9_repo_server_url res['rhsm_pwd'] = None res['rhsm_user'] = self.rhsm_user res['system_ks'] = self.system_ks diff --git a/lib/cr_vmware_tpl/config/eval.py b/lib/cr_vmware_tpl/config/eval.py index 6af249c..4fc7e26 100644 --- a/lib/cr_vmware_tpl/config/eval.py +++ b/lib/cr_vmware_tpl/config/eval.py @@ -194,6 +194,8 @@ class ConfigEval(): re_rhsm_pwd = re.compile(r'^\s*rhsm[-_]?(?:pwd|password)\s*$', re.IGNORECASE) re_has_docs = re.compile( r'^\s*(?:vm[-_]?)?has[-_]?doc(?:s|umentation)?\s*$', re.IGNORECASE) + re_rhel9_repo_server = re.compile( + r'^\s*rhel9[-_]?repo[-_]?server(?:[-_]?url)?\s*$', re.IGNORECASE) for key in section.keys(): value = section[key] @@ -256,6 +258,8 @@ class ConfigEval(): if re_has_docs.match(key): self._vm_has_docs = to_bool(value) continue + if re_rhel9_repo_server.match(key) and value.strip(): + self._rhel9_repo_server_url = value.strip() return -- 2.39.5