mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 12:57:40 -02:30
Merge branch 'openstack_inventory_support' into upstream_master
* openstack_inventory_support: Use inventory_source source_vars to control what address we use for ansible_ssh_host Some small changes to tower openstack work
This commit is contained in:
@@ -938,7 +938,8 @@ class RunInventoryUpdate(BaseTask):
|
||||
username=credential.username,
|
||||
password=decrypt_field(credential, "password"),
|
||||
project_name=credential.project)
|
||||
openstack_data = {"clouds": {"devstack": {"auth": openstack_auth}}}
|
||||
private_state = str(inventory_update.source_vars_dict.get("private", "true"))
|
||||
openstack_data = {"clouds": {"devstack": {"private": private_state, "auth": openstack_auth}}}
|
||||
return yaml.safe_dump(openstack_data, default_flow_style=False, allow_unicode=True)
|
||||
|
||||
cp = ConfigParser.ConfigParser()
|
||||
|
||||
@@ -1898,3 +1898,19 @@ class InventoryUpdatesTest(BaseTransactionTest):
|
||||
other_inv_src_opts = {'source': 'custom', 'source_script': script_data['id']}
|
||||
with self.current_user(self.super_django_user):
|
||||
self.put(other_inv_src, other_inv_src_opts, expect=400)
|
||||
|
||||
def test_update_from_openstack(self):
|
||||
api_url = getattr(settings, 'TEST_OPENSTACK_HOST', '')
|
||||
api_user = getattr(settings, 'TEST_OPENSTACK_USER', '')
|
||||
api_password = getattr(settings, 'TEST_OPENSTACK_PASSWORD', '')
|
||||
api_project = getattr(settings, 'TEST_OPENSTACK_PROJECT', '')
|
||||
if not all([api_url, api_user, api_password, api_project]):
|
||||
self.skipTest("No test openstack credentials defined")
|
||||
self.create_test_license_file()
|
||||
credential = Credential.objects.create(kind='openstack',
|
||||
host=api_url,
|
||||
username=api_user,
|
||||
password=api_password,
|
||||
project=api_project)
|
||||
inventory_source = self.update_inventory_source(self.group, source='openstack', credential=credential)
|
||||
self.check_inventory_source(inventory_source)
|
||||
|
||||
Reference in New Issue
Block a user