Skip to content

Commit 5b17e5c

Browse files
authored
update: use singular form ANSIBLE_COLLECTIONS_PATH (ansible#15841)
* update: use singular form ANSIBLE_COLLECTIONS_PATH * update functional tests
1 parent 7b8b37d commit 5b17e5c

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

awx/main/tasks/jobs.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,6 @@ def build_env(self, job, private_data_dir, private_data_files=None):
917917
env['ANSIBLE_NET_AUTH_PASS'] = network_cred.get_input('authorize_password', default='')
918918

919919
path_vars = [
920-
('ANSIBLE_COLLECTIONS_PATHS', 'collections_paths', 'requirements_collections', '~/.ansible/collections:/usr/share/ansible/collections'),
921920
('ANSIBLE_ROLES_PATH', 'roles_path', 'requirements_roles', '~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles'),
922921
('ANSIBLE_COLLECTIONS_PATH', 'collections_path', 'requirements_collections', '~/.ansible/collections:/usr/share/ansible/collections'),
923922
]
@@ -1520,7 +1519,7 @@ def build_env(self, inventory_update, private_data_dir, private_data_files=None)
15201519
raise NotImplementedError('Cannot update file sources through the task system.')
15211520

15221521
if inventory_update.source == 'scm' and inventory_update.source_project_update:
1523-
env_key = 'ANSIBLE_COLLECTIONS_PATHS'
1522+
env_key = 'ANSIBLE_COLLECTIONS_PATH'
15241523
config_setting = 'collections_paths'
15251524
folder = 'requirements_collections'
15261525
default = '~/.ansible/collections:/usr/share/ansible/collections'
@@ -1538,12 +1537,12 @@ def build_env(self, inventory_update, private_data_dir, private_data_files=None)
15381537
paths = [config_values[config_setting]] + paths
15391538
paths = [os.path.join(CONTAINER_ROOT, folder)] + paths
15401539
env[env_key] = os.pathsep.join(paths)
1541-
if 'ANSIBLE_COLLECTIONS_PATHS' in env:
1542-
paths = env['ANSIBLE_COLLECTIONS_PATHS'].split(':')
1540+
if 'ANSIBLE_COLLECTIONS_PATH' in env:
1541+
paths = env['ANSIBLE_COLLECTIONS_PATH'].split(':')
15431542
else:
15441543
paths = ['~/.ansible/collections', '/usr/share/ansible/collections']
15451544
paths.append('/usr/share/automation-controller/collections')
1546-
env['ANSIBLE_COLLECTIONS_PATHS'] = os.pathsep.join(paths)
1545+
env['ANSIBLE_COLLECTIONS_PATH'] = os.pathsep.join(paths)
15471546

15481547
return env
15491548

awx/main/tests/functional/test_inventory_source_injectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def substitute_run(awx_receptor_job):
231231
len([True for k in content.keys() if k.endswith(inventory_filename)]) > 0
232232
), f"'{inventory_filename}' file not found in inventory update runtime files {content.keys()}"
233233

234-
env.pop('ANSIBLE_COLLECTIONS_PATHS', None) # collection paths not relevant to this test
234+
env.pop('ANSIBLE_COLLECTIONS_PATH', None)
235235
base_dir = os.path.join(DATA, 'plugins')
236236
if not os.path.exists(base_dir):
237237
os.mkdir(base_dir)

awx/playbooks/project_update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
# additional_galaxy_env contains environment variables are used for installing roles and collections and will take precedence over items in galaxy_task_env
202202
additional_galaxy_env:
203203
# These paths control where ansible-galaxy installs collections and roles on top the filesystem
204-
ANSIBLE_COLLECTIONS_PATHS: "{{ projects_root }}/.__awx_cache/{{ local_path }}/stage/requirements_collections"
204+
ANSIBLE_COLLECTIONS_PATH: "{{ projects_root }}/.__awx_cache/{{ local_path }}/stage/requirements_collections"
205205
ANSIBLE_ROLES_PATH: "{{ projects_root }}/.__awx_cache/{{ local_path }}/stage/requirements_roles"
206206
# Put the local tmp directory in same volume as collection destination
207207
# otherwise, files cannot be moved accross volumes and will cause error

0 commit comments

Comments
 (0)