From dde193f6fcf874d873a47e11452560ac8be0a790 Mon Sep 17 00:00:00 2001 From: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:00:16 +0100 Subject: [PATCH] Preserve Capsule host for build sanity failures --- pytest_fixtures/core/xdist.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pytest_fixtures/core/xdist.py b/pytest_fixtures/core/xdist.py index 71e0c037cbe..f34325bfdee 100644 --- a/pytest_fixtures/core/xdist.py +++ b/pytest_fixtures/core/xdist.py @@ -6,7 +6,7 @@ import pytest from robottelo.config import configure_airgun, configure_nailgun, settings -from robottelo.hosts import Capsule, Satellite +from robottelo.hosts import ContentHost, Satellite from robottelo.logging import logger @@ -17,17 +17,12 @@ def align_to_satellite(request, worker_id, satellite_factory): settings.set("server.hostname", None) yield # Checkout Sanity Capsule finally - if settings.capsule.hostname: - sanity_cap = Capsule.get_host_by_hostname(settings.capsule.hostname) - sanity_cap.unregister() - Broker(hosts=[sanity_cap]).checkin() - # Checkout Sanity Satellite finally - if settings.server.hostname: - sanity_sat = Satellite(settings.server.hostname) - sanity_sat.unregister() - if settings.server.auto_checkin: - broker_sat = Satellite.get_host_by_hostname(sanity_sat.hostname) - Broker(hosts=[broker_sat]).checkin() + for host in [settings.capsule.hostname, settings.server.hostname]: + if host: + sanity_host = ContentHost.get_host_by_hostname(host) + if settings.server.auto_checkin: + sanity_host.unregister() + Broker(hosts=[sanity_host]).checkin() else: # clear any hostname that may have been previously set settings.set("server.hostname", None)