awxkit: selecting inventory by name fails if name is a number
#7,541 opened on Jul 3, 2020
Repository metrics
- Stars
- (13,071 stars)
- PR merge metrics
- (Avg merge 24d 6h) (30 merged PRs in 30d)
Description
ISSUE TYPE
- Bug Report
SUMMARY
If an inventory or an inventory_source name consists only of numbers then this inventory or inventory_source can not be selected by name. But this is stated in the help description.
usage: awx inventory get [-h] [-f {json,yaml,jq,human}] [--filter TEXT] [--conf.color BOOLEAN] [-v] id
positional arguments:
id the ID (or unique name) of the resource
I'm in the progress of porting a script from tower-cli to awxkit and now I'm in a situation where I can not select any inventory or inventory_source because all these are named as customer numbers. This is probably a corner case, but in this case awxkit behaves differently than tower-cli.
ENVIRONMENT
- AWX version: 11.2.0
- AWX install method: docker
- Ansible version: 2.9.9
- Operating System: Fedora 32
- Web Browser: Firefox 74
STEPS TO REPRODUCE
awx --conf.host https://awx.example.com --conf.token mytoken --conf.insecure inventory create --name 123 --organization 1
{
"id": 10,
...
"name": "123",
"description": "",
"organization": 1,
}
awx --conf.host https://awx.example.com --conf.token mytoken --conf.insecure inventory get 123
{"detail": "Not found."}
EXPECTED RESULTS
The awx cli should be able to find inventories explicitly by name as tower-cli was doing it:
tower-cli inventory get -n 123 --insecure -t mytoken -h awx.example.com
{
"id": 10,
...
}
tower-cli uses an additional parameter instead of the positional argument.
ACTUAL RESULTS
The awx cli failes to find the inventory with name "123"
awx --conf.host https://awx.example.com --conf.token mytoken --conf.insecure inventory get 123
{"detail": "Not found."}