From 09cabaf702bab81d2d4abd9b0f81913b5b033921 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Mon, 14 Aug 2017 22:10:06 +0530 Subject: [PATCH] Use response.content instead of response object (#25772) vca module utility uses response object instead of response.content which raises exception in while fail_json call. Use content attribute from response object instead which is exact description of HTTP Response error. Fixes #25378 Signed-off-by: Abhijeet Kasurde --- lib/ansible/module_utils/vca.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/vca.py b/lib/ansible/module_utils/vca.py index 7750a510903..29805f99f6a 100644 --- a/lib/ansible/module_utils/vca.py +++ b/lib/ansible/module_utils/vca.py @@ -141,7 +141,7 @@ class VcaAnsibleModule(AnsibleModule): login_org = self.params['org'] if not self.vca.login(password=password, org=login_org): - self.fail('Login to VCA failed', response=self.vca.response) + self.fail('Login to VCA failed', response=self.vca.response.content) try: method_name = 'login_%s' % service_type @@ -150,7 +150,7 @@ class VcaAnsibleModule(AnsibleModule): except AttributeError: self.fail('no login method exists for service_type %s' % service_type) except VcaError as e: - self.fail(e.message, response=self.vca.response, **e.kwargs) + self.fail(e.message, response=self.vca.response.content, **e.kwargs) def login_vca(self): instance_id = self.params['instance_id']