From 2cf0056f01651dcfed41ed368d678d261f100c49 Mon Sep 17 00:00:00 2001 From: Roman Blanco Date: Thu, 3 Apr 2025 09:54:11 +0000 Subject: [PATCH] fix: improve wording for unassignable Policy When Compliance tries to assign Host to a Policy, it returns either 202 in case of success or 404 in any other case. When one tries to assign a Host that already has a Policy assigned, the Policy is not anymore in the list of available options, hence the process can not succeed with creating the link and returns 404. That in the logic of insights-client seems as failure, and it returns non-zero error status with the confusing message "Policy ... does not exist". This commit is to improve the message sent in such case to make it less misleading. --- insights/specs/datasources/compliance/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/insights/specs/datasources/compliance/__init__.py b/insights/specs/datasources/compliance/__init__.py index 5cf624b47..cb749a6df 100644 --- a/insights/specs/datasources/compliance/__init__.py +++ b/insights/specs/datasources/compliance/__init__.py @@ -227,7 +227,7 @@ def policy_link(self, policy_id, opt): logger.info("Operation completed successfully.\n") return 0 else: - logger.error("Policy ID {0} does not exist.".format(policy_id)) + logger.error("Policy ID {0} can not be assigned.".format(policy_id)) return constants.sig_kill_bad def get_system_policies(self):