From f510eea1f47605e488e29bfdd5287d81b85092b1 Mon Sep 17 00:00:00 2001 From: karmab Date: Wed, 27 Dec 2023 00:26:38 +0100 Subject: [PATCH] update host: use looser matching --- ailib/__init__.py | 6 +++--- ailib/common/__init__.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ailib/__init__.py b/ailib/__init__.py index e68bff8..b70afe9 100644 --- a/ailib/__init__.py +++ b/ailib/__init__.py @@ -881,7 +881,7 @@ def update_host(self, hostname, overrides): infra_env_id = self.get_infra_env_id(infra_env) hosts = self.client.v2_list_hosts(infra_env_id=infra_env_id) matchingids = [host['id'] for host in hosts - if host['requested_hostname'] == hostname or host['id'] == hostname or + if host['requested_hostname'].startswith(hostname) or host['id'].startswith(hostname) or match_mac(host, hostname)] if matchingids: infra_envs[infra_env_id] = matchingids @@ -1515,8 +1515,8 @@ def create_deployment(self, cluster, overrides, force=False, debug=False): self.create_infra_env(infraenv, overrides) del overrides['cluster'] if not self.saas: - info("Waiting 120s for iso to be available") - sleep(120) + info("Waiting 240s for iso to be available") + sleep(240) if 'iso_url' in overrides: download_iso_path = overrides.get('download_iso_path') if download_iso_path is None: diff --git a/ailib/common/__init__.py b/ailib/common/__init__.py index c47942a..f54f357 100644 --- a/ailib/common/__init__.py +++ b/ailib/common/__init__.py @@ -162,8 +162,6 @@ def create_onprem(overrides={}, debug=False): pod_url = "https://raw.githubusercontent.com/openshift/assisted-service/master/deploy/podman/pod.yml" response = urllib.request.urlopen(pod_url).read().decode('utf-8') response = response.replace('latest', onprem_version).replace(f'centos7:{onprem_version}', 'centos7:latest') - if ipv6: - response = response.replace('127.0.0.1', f"[{ip}") p.write(response) if os.path.exists('configmap.yml'): info("Using existing configmap.yml") @@ -173,8 +171,10 @@ def create_onprem(overrides={}, debug=False): cm_name = 'okd-configmap' if overrides.get('okd', False) else 'configmap' cm_url = "https://raw.githubusercontent.com/openshift/assisted-service/master/deploy/podman/" cm_url += f"{cm_name}.yml" - response = urllib.request.urlopen(cm_url) - c.write(response.read().decode('utf-8')) + response = urllib.request.urlopen(cm_url).read().decode('utf-8') + if ipv6: + response = response.replace('127.0.0.1:8090', f'"[{ip}":8090') + c.write(response) if ipv6 and '[' not in ip: ip = f"[{ip}]" IMAGE_SERVICE_BASE_URL = f'http://{ip}:8888' @@ -198,7 +198,7 @@ def create_onprem(overrides={}, debug=False): call(cmd, shell=True) storage = '--storage-driver vfs' if 'KUBERNETES_SERVICE_PORT' in os.environ else '' network = '--network assistedv6' if ipv6 else '' - cmd = f"podman {storage} {network} play kube --replace --configmap {tmpdir}/configmap.yml {tmpdir}/pod.yml" + cmd = f"podman {storage} play kube {network} --replace --configmap {tmpdir}/configmap.yml {tmpdir}/pod.yml" info(f"Running: {cmd}") call(cmd, shell=True)