From 0fb7c859f450b47e5a4a301a275eb27d804e4975 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 3 Sep 2019 14:11:45 -0400 Subject: [PATCH] Revert 9b95cc27c4840140996a036223e2909a30953b95. We do not want to create a new setting for a on-Tower-host global collection path at this time. --- awx/main/tasks.py | 9 --------- .../test_inventory_source_injectors.py | 1 - awx/main/tests/unit/test_tasks.py | 19 ------------------- awx/settings/defaults.py | 3 --- awx/settings/local_settings.py.docker_compose | 2 -- docs/collections.md | 7 ------- 6 files changed, 41 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index e8f671ee9e..fb3a2184f4 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -876,10 +876,6 @@ class BaseTask(object): show_paths = self.proot_show_paths + local_paths + \ settings.AWX_PROOT_SHOW_PATHS - # Help the user out by including the collections path inside the bubblewrap environment - if getattr(settings, 'AWX_ANSIBLE_COLLECTIONS_PATHS', []): - show_paths.extend(settings.AWX_ANSIBLE_COLLECTIONS_PATHS) - pi_path = settings.AWX_PROOT_BASE_PATH if not self.instance.is_isolated(): pi_path = tempfile.mkdtemp( @@ -966,11 +962,6 @@ class BaseTask(object): if self.should_use_proot(instance): env['PROOT_TMP_DIR'] = settings.AWX_PROOT_BASE_PATH env['AWX_PRIVATE_DATA_DIR'] = private_data_dir - - if 'ANSIBLE_COLLECTIONS_PATHS' in env: - env['ANSIBLE_COLLECTIONS_PATHS'] += os.pathsep + os.pathsep.join(settings.AWX_ANSIBLE_COLLECTIONS_PATHS) - else: - env['ANSIBLE_COLLECTIONS_PATHS'] = os.pathsep.join(settings.AWX_ANSIBLE_COLLECTIONS_PATHS) return env def should_use_proot(self, instance): diff --git a/awx/main/tests/functional/test_inventory_source_injectors.py b/awx/main/tests/functional/test_inventory_source_injectors.py index e1dbe74761..7f7e43c993 100644 --- a/awx/main/tests/functional/test_inventory_source_injectors.py +++ b/awx/main/tests/functional/test_inventory_source_injectors.py @@ -262,7 +262,6 @@ def test_inventory_update_injected_content(this_kind, script_or_plugin, inventor """ private_data_dir = envvars.pop('AWX_PRIVATE_DATA_DIR') assert envvars.pop('ANSIBLE_INVENTORY_ENABLED') == ('auto' if use_plugin else 'script') - assert envvars.pop('ANSIBLE_COLLECTIONS_PATHS') == os.pathsep.join(settings.AWX_ANSIBLE_COLLECTIONS_PATHS) set_files = bool(os.getenv("MAKE_INVENTORY_REFERENCE_FILES", 'false').lower()[0] not in ['f', '0']) env, content = read_content(private_data_dir, envvars, inventory_update) base_dir = os.path.join(DATA, script_or_plugin) diff --git a/awx/main/tests/unit/test_tasks.py b/awx/main/tests/unit/test_tasks.py index b2ff7d7fe4..c242ee6910 100644 --- a/awx/main/tests/unit/test_tasks.py +++ b/awx/main/tests/unit/test_tasks.py @@ -444,7 +444,6 @@ class TestGenericRun(): settings.AWX_PROOT_HIDE_PATHS = ['/AWX_PROOT_HIDE_PATHS1', '/AWX_PROOT_HIDE_PATHS2'] settings.ANSIBLE_VENV_PATH = '/ANSIBLE_VENV_PATH' settings.AWX_VENV_PATH = '/AWX_VENV_PATH' - settings.AWX_ANSIBLE_COLLECTIONS_PATHS = ['/AWX_COLLECTION_PATH1', '/AWX_COLLECTION_PATH2'] process_isolation_params = task.build_params_process_isolation(job, private_data_dir, cwd) assert True is process_isolation_params['process_isolation'] @@ -454,10 +453,6 @@ class TestGenericRun(): "The per-job private data dir should be in the list of directories the user can see." assert cwd in process_isolation_params['process_isolation_show_paths'], \ "The current working directory should be in the list of directories the user can see." - assert '/AWX_COLLECTION_PATH1' in process_isolation_params['process_isolation_show_paths'], \ - "AWX global collection directory 1 of 2 should get added to the list of directories the user can see." - assert '/AWX_COLLECTION_PATH2' in process_isolation_params['process_isolation_show_paths'], \ - "AWX global collection directory 2 of 2 should get added to the list of directories the user can see." for p in [settings.AWX_PROOT_BASE_PATH, '/etc/tower', @@ -517,20 +512,6 @@ class TestGenericRun(): env = task.build_env(job, private_data_dir) assert env['FOO'] == 'BAR' - def test_awx_task_env_respects_ansible_collections_paths(self, patch_Job, private_data_dir): - job = Job(project=Project(), inventory=Inventory()) - - task = tasks.RunJob() - task._write_extra_vars_file = mock.Mock() - - with mock.patch('awx.main.tasks.settings.AWX_ANSIBLE_COLLECTIONS_PATHS', ['/AWX_COLLECTION_PATH']): - with mock.patch('awx.main.tasks.settings.AWX_TASK_ENV', {'ANSIBLE_COLLECTIONS_PATHS': '/MY_COLLECTION1:/MY_COLLECTION2'}): - env = task.build_env(job, private_data_dir) - used_paths = env['ANSIBLE_COLLECTIONS_PATHS'].split(':') - assert used_paths[-1].endswith('/requirements_collections') - used_paths.pop() - assert used_paths == ['/MY_COLLECTION1', '/MY_COLLECTION2', '/AWX_COLLECTION_PATH'] - def test_valid_custom_virtualenv(self, patch_Job, private_data_dir): job = Job(project=Project(), inventory=Inventory()) diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index b9274c62f4..443219217a 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -1189,9 +1189,6 @@ AWX_REQUEST_PROFILE = False # Delete temporary directories created to store playbook run-time AWX_CLEANUP_PATHS = True -# Expose collections to Ansible playbooks -AWX_ANSIBLE_COLLECTIONS_PATHS = ['/var/lib/awx/collections'] - MIDDLEWARE = [ 'awx.main.middleware.TimingMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', diff --git a/awx/settings/local_settings.py.docker_compose b/awx/settings/local_settings.py.docker_compose index 80b68e6193..d0d5f8c819 100644 --- a/awx/settings/local_settings.py.docker_compose +++ b/awx/settings/local_settings.py.docker_compose @@ -276,5 +276,3 @@ TEST_OPENSTACK_PROJECT = '' # Azure credentials. TEST_AZURE_USERNAME = '' TEST_AZURE_KEY_DATA = '' - -AWX_ANSIBLE_COLLECTIONS_PATHS = ['/tmp/collections'] diff --git a/docs/collections.md b/docs/collections.md index fe10eb3686..a0fec218f3 100644 --- a/docs/collections.md +++ b/docs/collections.md @@ -53,10 +53,3 @@ Example of tmp directory where job is running: └── tmp_6wod58k ``` - -### Global Collections Path - -AWX appends the directories specified in `AWX_ANSIBLE_COLLECTIONS_PATHS` -to the environment variable `ANSIBLE_COLLECTIONS_PATHS`. The default value of `AWX_ANSIBLE_COLLECTIONS_PATHS` -contains `/var/lib/awx/collections`. It is recommended that place your collections that you wish to call in -your playbooks into this path.