awx
awx copied to clipboard
Normal user Can't choose project for adding inventory source to inventory
Please confirm the following
- [X] I agree to follow this project's code of conduct.
- [X] I have checked the current issues for duplicates.
- [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.
Bug Summary
Normal user with inventory admin/use and project admin/use permissions Can't choose project for inventory source
AWX version
22.1.0
Select the relevant components
- [X] UI
- [ ] API
- [ ] Docs
- [ ] Collection
- [ ] CLI
- [ ] Other
Installation method
kubernetes
Modifications
no
Ansible version
No response
Operating system
No response
Web browser
No response
Steps to reproduce
Go to inventories, choose or create inventory Next going to Sources - Add Source - Source from a Project Project - field blocked
Expected results
Pick a project with inventory file
Actual results
Project Field is blocked
Additional information
No response
@AlanCoding in determining whether or not to disable this field in the UI we're looking at whether or not a user can create a project: https://github.com/ansible/awx/blob/devel/awx/ui/src/components/Lookup/ProjectLookup.js#L61-L63 (whether or not POST is present in the options actions). Is that correct or should we be looking at something different there? Seems like we should be checking to see if the user in question has at least use
role on at least one project to determine whether or not to disable this lookup. Is that correct?
^ that sounds right. A user can have use_role
to a project without having the project_admin_role
necessary to create new projects which is what would dictate the POST presentation in OPTIONS.
But from a UX perspective, if you have already selected the other box to source the inventory from a project, then the form will be invalid without a project filled in. I'm not sure if I see a lot of value in greying out the box in the first place, because if the source
is selected to be any option other than source-from-project then the box (to select project) should be hidden.
I ran into this issue in AAP at work. Is there any more testing needed to narrow down the issue or does a implementation just need to be decided on?
I ran into the same issue on AWX version 23.9, please check that the user you mentioned has use permission for at least one project with a valid ansible playbook.
It seems that for each Git projects, if the project does not contain at least one ansible playbook, AWX will mark the project as "invalid" and hide it as if it doesn't exist.
In my case, I created an organization test and a team test, the user test is a member of test team, and a member of test organization. I created a project that has no ansible playbooks, only ansible inventories, called "awx". And I gave the inventory manager permission to test team, created an inventory and tried to add invenroty source via "Sourced from project", and found the project selector disabled just like this :
then I added another project called test with a valid ansible playbook, the disabled button is still disabled but displayed "test":
And in that case, the test user has use permission of 2 projects, awx and test :
Project awx doesn't has an ansible playbook, while project test has. So the only option that can be selected in the selector is test project.
So the solution of the problem is to make sure each of the projects which test user has use permission, has at least one ansible playbook in the project.