From 4bb4c7e68ed2bbac95b0d2cec3822b2ed8104b72 Mon Sep 17 00:00:00 2001 From: camradal Date: Fri, 13 May 2016 23:57:08 -0700 Subject: [PATCH] vCloud module utils error handling bug fixes (#15859) * Fix AttributeError that hides login errors * Typo fixes for vca error messages --- lib/ansible/module_utils/vca.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/module_utils/vca.py b/lib/ansible/module_utils/vca.py index e895d28a7d9..6c809887a96 100644 --- a/lib/ansible/module_utils/vca.py +++ b/lib/ansible/module_utils/vca.py @@ -111,7 +111,7 @@ class VcaAnsibleModule(AnsibleModule): def create_instance(self): service_type = self.params.get('service_type', DEFAULT_SERVICE_TYPE) - if service_type == 'vcd': + if service_type == 'vcd': host = self.params['host'] else: host = LOGIN_HOST[service_type] @@ -136,7 +136,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.content) + self.fail('Login to VCA failed', response=self.vca.response) try: method_name = 'login_%s' % service_type @@ -145,7 +145,7 @@ class VcaAnsibleModule(AnsibleModule): except AttributeError: self.fail('no login method exists for service_type %s' % service_type) except VcaError, e: - self.fail(e.message, response=self.vca.response.content, **e.kwargs) + self.fail(e.message, response=self.vca.response, **e.kwargs) def login_vca(self): instance_id = self.params['instance_id'] @@ -160,14 +160,14 @@ class VcaAnsibleModule(AnsibleModule): org = self.params['org'] if not org: - raise VcaError('missing required or for service_type vchs') + raise VcaError('missing required org for service_type vchs') self.vca.login_to_org(service_id, org) def login_vcd(self): org = self.params['org'] if not org: - raise VcaError('missing required or for service_type vchs') + raise VcaError('missing required org for service_type vcd') if not self.vca.token: raise VcaError('unable to get token for service_type vcd')