diff --git a/manager/cve_handler.py b/manager/cve_handler.py index 3907ffc27..023c8861f 100644 --- a/manager/cve_handler.py +++ b/manager/cve_handler.py @@ -269,7 +269,7 @@ def _full_query(rh_account_id, synopsis, parsed_args, filters, remediation_filte InventoryHosts.updated, InventoryHosts.insights_id, ( - SystemGroupSet.groups.alias("inventory_group") + fn.COALESCE(SystemGroupSet.groups, "[]").alias("inventory_group") if UNLEASH.is_enabled(CYNDI_REPLICATION_REPLACEMENT) else InventoryHosts.groups.alias("inventory_group") ), @@ -342,7 +342,7 @@ def _unpatched_full_query(self, rh_account_id, synopsis, parsed_args, filters) - InventoryHosts.updated, InventoryHosts.insights_id, ( - SystemGroupSet.groups.alias("inventory_group") + fn.COALESCE(SystemGroupSet.groups, "[]").alias("inventory_group") if UNLEASH.is_enabled(CYNDI_REPLICATION_REPLACEMENT) else InventoryHosts.groups.alias("inventory_group") ), @@ -400,7 +400,7 @@ def _id_query(rh_account_id, synopsis, parsed_args, filters, remediation_filter= InventoryHosts.updated, InventoryHosts.insights_id, ( - SystemGroupSet.groups.alias("inventory_group") + fn.COALESCE(SystemGroupSet.groups, "[]").alias("inventory_group") if UNLEASH.is_enabled(CYNDI_REPLICATION_REPLACEMENT) else InventoryHosts.groups.alias("inventory_group") ), @@ -456,7 +456,7 @@ def _unpatched_id_query(self, rh_account_id, synopsis, parsed_args, filters) -> InventoryHosts.updated, InventoryHosts.insights_id, ( - SystemGroupSet.groups.alias("inventory_group") + fn.COALESCE(SystemGroupSet.groups, "[]").alias("inventory_group") if UNLEASH.is_enabled(CYNDI_REPLICATION_REPLACEMENT) else InventoryHosts.groups.alias("inventory_group") ), diff --git a/manager/system_handler.py b/manager/system_handler.py index 24261b1ab..b9ebdaf41 100644 --- a/manager/system_handler.py +++ b/manager/system_handler.py @@ -529,7 +529,7 @@ def _full_query(rh_account_id): OS_INFO_QUERY.alias("os"), RHSM_LOCK_QUERY.alias("rhsm_lock"), ( - SystemGroupSet.groups.alias("inventory_group") + fn.COALESCE(SystemGroupSet.groups, "[]").alias("inventory_group") if UNLEASH.is_enabled(CYNDI_REPLICATION_REPLACEMENT) else InventoryHosts.groups.alias("inventory_group") ), @@ -833,7 +833,7 @@ def handle_get(cls, **kwargs): OS_INFO_QUERY.alias("os"), RHSM_LOCK_QUERY.alias("rhsm_lock"), ( - SystemGroupSet.groups.alias("inventory_group") + fn.COALESCE(SystemGroupSet.groups, "[]").alias("inventory_group") if UNLEASH.is_enabled(CYNDI_REPLICATION_REPLACEMENT) else InventoryHosts.groups.alias("inventory_group") ),