From 3a8044754c0afe4e1ea6991f204594b4522f4a15 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Tue, 3 Nov 2015 09:37:38 -0500 Subject: [PATCH] add openstack cred file to env for jt launch --- awx/main/tasks.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 0df4c195ad..93303f511c 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -614,6 +614,21 @@ class RunJob(BaseTask): if credential.ssh_key_data not in (None, ''): private_data[cred_name] = decrypt_field(credential, 'ssh_key_data') or '' + if job.cloud_credential and job.cloud_credential.kind == 'openstack': + credential = job.cloud_credential + openstack_auth = dict(auth_url=credential.host, + username=credential.username, + password=decrypt_field(credential, "password"), + project_name=credential.project) + openstack_data = { + 'clouds': { + 'devstack': { + 'auth': openstack_auth, + }, + }, + } + private_data['cloud_credential'] = yaml.safe_dump(openstack_data, default_flow_style=False, allow_unicode=True) + return private_data def build_passwords(self, job, **kwargs): @@ -689,6 +704,8 @@ class RunJob(BaseTask): env['VMWARE_USER'] = cloud_cred.username env['VMWARE_PASSWORD'] = decrypt_field(cloud_cred, 'password') env['VMWARE_HOST'] = cloud_cred.host + elif cloud_cred and cloud_cred.kind == 'openstack': + env['OS_CLIENT_CONFIG_FILE'] = kwargs.get('private_data_files', {}).get('cloud_credential', '') # Set environment variables related to scan jobs if job.job_type == PERM_INVENTORY_SCAN: