diff --git a/tmt/steps/provision/mrack.py b/tmt/steps/provision/mrack.py index bf072f108b..07233b060e 100644 --- a/tmt/steps/provision/mrack.py +++ b/tmt/steps/provision/mrack.py @@ -784,8 +784,15 @@ def _translate_tmt_hw(self, hw: tmt.hardware.Hardware) -> dict[str, Any]: logger.debug('Transformed hardware', tmt.utils.dict_to_yaml(transformed.to_mrack())) + # Mrack does not handle well situation when the filter + # consists of just a single filtering element, e.g. just + # `hostname`. In that case, the element is converted into + # XML element incorrectly. Therefore wrapping our filter + # with `` group, even if it has just a single child, + # it works around the problem. + # See https://github.com/teemtee/tmt/issues/3442 return { - 'hostRequires': transformed.to_mrack() + 'hostRequires': MrackHWAndGroup(children=[transformed]).to_mrack() } def create_host_requirement(self, host: CreateJobParameters) -> dict[str, Any]: