From 90b8ddf598c24d72d0af3a5de83a2f2676aaf4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Prchl=C3=ADk?= Date: Mon, 13 Jan 2025 19:15:47 +0100 Subject: [PATCH] Fix possible double normalization of hardware field (#3462) It seems to happen in the very simple workflow, e.g. `tmt run discover plan --name '...'`. --- tmt/steps/provision/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tmt/steps/provision/__init__.py b/tmt/steps/provision/__init__.py index ac0767d800..bf48e07b55 100644 --- a/tmt/steps/provision/__init__.py +++ b/tmt/steps/provision/__init__.py @@ -632,7 +632,7 @@ def format(self) -> Iterator[tuple[str, str, str]]: def normalize_hardware( key_address: str, - raw_hardware: Optional[tmt.hardware.Spec], + raw_hardware: Union[None, tmt.hardware.Spec, tmt.hardware.Hardware], logger: tmt.log.Logger) -> Optional[tmt.hardware.Hardware]: """ Normalize a ``hardware`` key value. @@ -645,6 +645,9 @@ def normalize_hardware( if raw_hardware is None: return None + if isinstance(raw_hardware, tmt.hardware.Hardware): + return raw_hardware + # From command line if isinstance(raw_hardware, (list, tuple)): merged: dict[str, Any] = {}