diff --git a/common/utils.py b/common/utils.py index d8ece1b96..85dc4aeea 100644 --- a/common/utils.py +++ b/common/utils.py @@ -7,6 +7,7 @@ from datetime import timedelta from datetime import timezone from time import sleep +from typing import Optional import asyncpg import requests @@ -400,6 +401,6 @@ async def executemany_fetchall(cur) -> []: return res -def show_cves_without_errata(db_flag: bool) -> bool: +def show_cves_without_errata(db_flag: bool) -> Optional[bool]: """Show whether CVEs without Errata feature is enabled""" - return CFG.cves_without_errata and db_flag + return db_flag if CFG.cves_without_errata else None diff --git a/manager.spec.yaml b/manager.spec.yaml index 81c1e2be8..7b64c75e6 100644 --- a/manager.spec.yaml +++ b/manager.spec.yaml @@ -1415,7 +1415,7 @@ components: cves_without_errata: type: boolean description: CVEs without Errata feature flag - nullable: false + nullable: true advisory_available: type: string description: Shows whether a CVE has available advisory or not @@ -1478,7 +1478,7 @@ components: cves_without_errata: type: boolean description: CVEs without Errata feature flag - nullable: false + nullable: true group_name: type: string description: Name of the inventory group. @@ -1591,7 +1591,7 @@ components: cves_without_errata: type: boolean description: CVEs without Errata feature flag - nullable: false + nullable: true required: - business_risk_id - cvss_from diff --git a/manager/base.py b/manager/base.py index d4e3277e3..6d33e84d2 100644 --- a/manager/base.py +++ b/manager/base.py @@ -628,7 +628,7 @@ def get_account_data(account): result = list(result) result[3] = show_cves_without_errata(result[3]) return result - return None, None, None, False + return None, None, None, None def update_cve_cache_keepalive(account_id, last_timestamp): diff --git a/tests/manager_tests/schemas.py b/tests/manager_tests/schemas.py index 75987e38c..8189c44ab 100644 --- a/tests/manager_tests/schemas.py +++ b/tests/manager_tests/schemas.py @@ -234,7 +234,7 @@ "rhel_version": Or(None, str), "ansible": Or(None, bool), "mssql": Or(None, bool), - "cves_without_errata": bool, + "cves_without_errata": Or(None, bool), "advisory_available": Or(None, bool), "group_id": Or(None, str), "group_name": Or(None, str), @@ -316,7 +316,7 @@ "first_reported_to": Or(None, str), "advisory_available": Or(None, bool), "remediation": Or(None, int), - "cves_without_errata": bool, + "cves_without_errata": Or(None, bool), } _system_cves_meta.update(_meta) @@ -353,7 +353,7 @@ "remediation": Or(None, int), "ansible": Or(None, bool), "mssql": Or(None, bool), - "cves_without_errata": bool, + "cves_without_errata": Or(None, bool), "group_id": Or(None, str), "group_name": Or(None, str), "ungrouped_hosts": Or(None, bool),