Fix logging into vCloud Director and expose verify_certs argument (#15533)

This commit is contained in:
camradal 2016-05-05 06:48:54 -07:00 committed by Brian Coca
parent 56ba10365c
commit be87cd8c26

View file

@ -46,7 +46,8 @@ def vca_argument_spec():
api_version=dict(default=DEFAULT_VERSION), api_version=dict(default=DEFAULT_VERSION),
service_type=dict(default=DEFAULT_SERVICE_TYPE, choices=SERVICE_MAP.keys()), service_type=dict(default=DEFAULT_SERVICE_TYPE, choices=SERVICE_MAP.keys()),
vdc_name=dict(), vdc_name=dict(),
gateway_name=dict(default='gateway') gateway_name=dict(default='gateway'),
verify_certs=dict(type='bool', default=True)
) )
class VcaAnsibleModule(AnsibleModule): class VcaAnsibleModule(AnsibleModule):
@ -130,7 +131,11 @@ class VcaAnsibleModule(AnsibleModule):
service_type = self.params['service_type'] service_type = self.params['service_type']
password = self.params['password'] password = self.params['password']
if not self.vca.login(password=password): login_org = None
if service_type == 'vcd':
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.content)
try: try: