ansible/awx

Inventory File Import Code Bugy

Open

#12,854 opened on Sep 8, 2022

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Python (3,333 forks)batch import
communityhelp wantedtype:bug

Repository metrics

Stars
 (13,071 stars)
PR merge metrics
 (Avg merge 24d 6h) (30 merged PRs in 30d)

Description

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.

Bug Summary

in https://github.com/ansible/awx/blob/devel/awx/main/utils/ansible.py#L61 the part if filename in ['inventory', 'hosts']: is wrong, how is implemented, now is not needed because the files without extension also listed due to elif '.' in suspected_ext: # If not using those extensions, inventory must have no extension return None

Inventory Files would also use yml json or yaml extensions. At least, files hosts.yml hosts.yaml hosts.json, inventory.yml inventory.yaml inventory.json should be found. Or all files with host.* or inventory.*

I think if filename in ['inventory', 'hosts']: should be if filename in ['inventory', 'hosts', 'hosts.yml', 'hosts.yaml' .......... ]: or
if filenamewithoutextension in ['inventory', 'hosts'] would solve the problem.

AWX version

latest

Select the relevant components

  • UI
  • API
  • Docs
  • Collection
  • CLI
  • Other

Installation method

N/A

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

No response

Steps to reproduce

in tower get a inventory source configured to git repo and look for the inventory files listed

Expected results

all inventory files listed oder at least hosts.yml hosts.yaml hosts.json, inventory.yml inventory.yaml inventory.json files

Actual results

no hosts.yml hosts.yaml hosts.json, inventory.yml inventory.yaml inventory.json listed

Additional information

No response

Contributor guide