mirror of
https://github.com/resf/distro-tools.git
synced 2024-11-25 06:31:26 +00:00
Final RPM nvra compat fix
This commit is contained in:
parent
77cab63d2f
commit
7234e90b5c
@ -72,8 +72,8 @@ class Advisory_Pydantic_V2_Fix(BaseModel):
|
|||||||
description: str
|
description: str
|
||||||
|
|
||||||
|
|
||||||
class Advisory_Pydantic_V2_RPM(BaseModel):
|
class Advisory_Pydantic_V2_RPMs(BaseModel):
|
||||||
nevra: str
|
nvras: list[str]
|
||||||
|
|
||||||
|
|
||||||
class Advisory_Pydantic_V2_CVE(BaseModel):
|
class Advisory_Pydantic_V2_CVE(BaseModel):
|
||||||
@ -99,7 +99,7 @@ class Advisory_Pydantic_V2(BaseModel):
|
|||||||
cves: list[Advisory_Pydantic_V2_CVE]
|
cves: list[Advisory_Pydantic_V2_CVE]
|
||||||
references: list[str]
|
references: list[str]
|
||||||
publishedAt: str
|
publishedAt: str
|
||||||
rpms: dict[str, list[Advisory_Pydantic_V2_RPM]]
|
rpms: dict[str, Advisory_Pydantic_V2_RPMs]
|
||||||
rebootSuggested: bool
|
rebootSuggested: bool
|
||||||
buildReferences: list[str]
|
buildReferences: list[str]
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from pydantic import BaseModel
|
|||||||
from rssgen.feed import RssGenerator
|
from rssgen.feed import RssGenerator
|
||||||
|
|
||||||
from apollo.db import Advisory, RedHatIndexState
|
from apollo.db import Advisory, RedHatIndexState
|
||||||
from apollo.db.serialize import Advisory_Pydantic_V2, Advisory_Pydantic_V2_CVE, Advisory_Pydantic_V2_Fix, Advisory_Pydantic_V2_RPM
|
from apollo.db.serialize import Advisory_Pydantic_V2, Advisory_Pydantic_V2_CVE, Advisory_Pydantic_V2_Fix, Advisory_Pydantic_V2_RPMs
|
||||||
from apollo.server.settings import UI_URL, COMPANY_NAME, MANAGING_EDITOR, get_setting
|
from apollo.server.settings import UI_URL, COMPANY_NAME, MANAGING_EDITOR, get_setting
|
||||||
|
|
||||||
from common.fastapi import RenderErrorTemplateException
|
from common.fastapi import RenderErrorTemplateException
|
||||||
@ -128,16 +128,9 @@ def v3_advisory_to_v2(
|
|||||||
for pkg in advisory.packages:
|
for pkg in advisory.packages:
|
||||||
name = f"{pkg.supported_product.variant} {pkg.supported_products_rh_mirror.match_major_version}"
|
name = f"{pkg.supported_product.variant} {pkg.supported_products_rh_mirror.match_major_version}"
|
||||||
if name not in rpms:
|
if name not in rpms:
|
||||||
rpms[name] = []
|
rpms[name] = Advisory_Pydantic_V2_RPMs(nvras=[])
|
||||||
if pkg.nevra not in rpms[name]:
|
if pkg.nevra not in rpms[name].nvras:
|
||||||
rpms[name].append(pkg.nevra)
|
rpms[name].nvras.append(pkg.nevra)
|
||||||
|
|
||||||
rpms_res = {}
|
|
||||||
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"
|
published_at = advisory.published_at.isoformat("T"
|
||||||
).replace("+00:00", "") + "Z"
|
).replace("+00:00", "") + "Z"
|
||||||
@ -156,7 +149,7 @@ def v3_advisory_to_v2(
|
|||||||
shortCode=advisory.name[0:2],
|
shortCode=advisory.name[0:2],
|
||||||
topic=advisory.topic if advisory.topic else "",
|
topic=advisory.topic if advisory.topic else "",
|
||||||
solution=None,
|
solution=None,
|
||||||
rpms=rpms_res,
|
rpms=rpms,
|
||||||
affectedProducts=affected_products,
|
affectedProducts=affected_products,
|
||||||
references=[],
|
references=[],
|
||||||
rebootSuggested=False,
|
rebootSuggested=False,
|
||||||
|
Loading…
Reference in New Issue
Block a user