From ec3c4de1f71bf92f0f749127443f359c2c1f9f74 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Fri, 1 May 2020 09:53:02 -0400 Subject: [PATCH] Fix openstack and logic and update some tests --- awx/main/models/inventory.py | 7 +++++++ .../tests/functional/models/test_inventory.py | 19 ------------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index d4a1c5f3b7..9c64377243 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -2277,6 +2277,13 @@ class openstack(PluginFileInjector): ret['inventory_hostname'] = use_host_name_for_name(source_vars['use_hostnames']) return ret + def get_plugin_env(self, inventory_update, private_data_dir, private_data_files): + env = super(openstack, self).get_plugin_env(inventory_update, private_data_dir, private_data_files) + credential = inventory_update.get_cloud_credential() + cred_data = private_data_files['credentials'] + env['OS_CLIENT_CONFIG_FILE'] = cred_data[credential] + return env + class rhv(PluginFileInjector): """ovirt uses the custom credential templating, and that is all diff --git a/awx/main/tests/functional/models/test_inventory.py b/awx/main/tests/functional/models/test_inventory.py index dc9d2bf164..bc0ad0fed4 100644 --- a/awx/main/tests/functional/models/test_inventory.py +++ b/awx/main/tests/functional/models/test_inventory.py @@ -227,13 +227,6 @@ class TestSCMClean: @pytest.mark.django_db class TestInventorySourceInjectors: - def test_should_use_plugin(self): - class foo(PluginFileInjector): - plugin_name = 'foo_compute' - initial_version = '2.7.8' - assert not foo('2.7.7').should_use_plugin() - assert foo('2.8').should_use_plugin() - def test_extra_credentials(self, project, credential): inventory_source = InventorySource.objects.create( name='foo', source='custom', source_project=project @@ -266,18 +259,6 @@ class TestInventorySourceInjectors: injector = InventorySource.injectors[source]('2.7.7') assert injector.filename == filename - @pytest.mark.parametrize('source,script_name', [ - ('ec2', 'ec2.py'), - ('rhv', 'ovirt4.py'), - ('satellite6', 'foreman.py'), - ('openstack', 'openstack_inventory.py') - ], ids=['ec2', 'rhv', 'satellite6', 'openstack']) - def test_script_filenames(self, source, script_name): - """Ansible has several exceptions in naming of scripts - """ - injector = InventorySource.injectors[source]('2.7.7') - assert injector.script_name == script_name - def test_group_by_azure(self): injector = InventorySource.injectors['azure_rm']('2.9') inv_src = InventorySource(