Further fix rpms in compat API

This commit is contained in:
Mustafa Gezen 2023-02-02 17:28:46 +01:00
parent dec33c5de6
commit 77cab63d2f
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1
2 changed files with 7 additions and 4 deletions

View File

@ -99,7 +99,7 @@ class Advisory_Pydantic_V2(BaseModel):
cves: list[Advisory_Pydantic_V2_CVE]
references: list[str]
publishedAt: str
rpms: dict[str, list[str]]
rpms: dict[str, list[Advisory_Pydantic_V2_RPM]]
rebootSuggested: bool
buildReferences: list[str]

View File

@ -133,8 +133,11 @@ def v3_advisory_to_v2(
rpms[name].append(pkg.nevra)
rpms_res = {}
for product, rpms in rpms.items():
rpms_res[product] = [Advisory_Pydantic_V2_RPM(nevra=x) for x in rpms]
if include_rpms:
for product, rpms in rpms.items():
rpms_res[product] = [
Advisory_Pydantic_V2_RPM(nevra=x) for x in rpms
]
published_at = advisory.published_at.isoformat("T"
).replace("+00:00", "") + "Z"
@ -153,7 +156,7 @@ def v3_advisory_to_v2(
shortCode=advisory.name[0:2],
topic=advisory.topic if advisory.topic else "",
solution=None,
rpms=rpms,
rpms=rpms_res,
affectedProducts=affected_products,
references=[],
rebootSuggested=False,