From 5df37d4279c837ac8082ec88395781a709fa4da0 Mon Sep 17 00:00:00 2001 From: Rebeccah Date: Thu, 1 Oct 2020 18:28:26 -0400 Subject: [PATCH] switched exit_json to be fail_json so it didn't trigger an error when attempting to utilize the missing_required_lib from ansible. Additionally fixed it for the second usage for correct usage. Given that it is an exception the correct one would not be to exit without failure, as exit_json does, but instead to use fail_json and be able to present the error --- awx_collection/plugins/module_utils/tower_awxkit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx_collection/plugins/module_utils/tower_awxkit.py b/awx_collection/plugins/module_utils/tower_awxkit.py index fc4e232f1b..03eb3a2a8f 100644 --- a/awx_collection/plugins/module_utils/tower_awxkit.py +++ b/awx_collection/plugins/module_utils/tower_awxkit.py @@ -24,7 +24,7 @@ class TowerAWXKitModule(TowerModule): # Die if we don't have AWX_KIT installed if not HAS_AWX_KIT: - self.exit_json(msg=missing_required_lib('awxkit')) + self.fail_json(msg=missing_required_lib('awxkit')) # Establish our conneciton object self.connection = Connection(self.host, verify=self.verify_ssl) @@ -38,7 +38,7 @@ class TowerAWXKitModule(TowerModule): self.connection.login(username=self.username, password=self.password) self.authenticated = True except Exception: - self.exit_json("Failed to authenticate") + self.fail_json("Failed to authenticate") def get_api_v2_object(self): if not self.apiV2Ref: