From 4667b0c0fc51895ed74d863e97053fe2e0387c2c Mon Sep 17 00:00:00 2001 From: Di Chen Date: Wed, 6 Dec 2023 10:43:40 +0800 Subject: [PATCH] Fix the wrong validator of ModulemdUnit.profiles [RHELDST-22116] Currently, the wrong validator resulted in a TypeError, saying pubtools-pulplib is validating the after-conversion "profiles" field as a dict: TypeError: "'profiles' must be (got frozendict.frozendict({'test': ['secondRepoRPM']}) that is a )." The validator of ModulemdUnit.profiles should be a frozendict rather than a dict after the "converter=frozenlist_or_none_converter" conversion. --- pubtools/pulplib/_impl/model/unit/modulemd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubtools/pulplib/_impl/model/unit/modulemd.py b/pubtools/pulplib/_impl/model/unit/modulemd.py index e895a27a..9a162b90 100644 --- a/pubtools/pulplib/_impl/model/unit/modulemd.py +++ b/pubtools/pulplib/_impl/model/unit/modulemd.py @@ -9,7 +9,7 @@ frozenlist_or_none_sorted_converter, frozendict_or_none_converter, ) -from ..validate import optional_list_of, optional_dict +from ..validate import optional_list_of, optional_frozendict @attr.s(kw_only=True, frozen=True) @@ -136,7 +136,7 @@ class ModulemdUnit(Unit): type=dict, pulp_field="profiles", default=None, - validator=optional_dict, + validator=optional_frozendict, converter=frozendict_or_none_converter, ) """The profiles of this modulemd unit."""