hello!
I dug a bit in the code and found this edge case for collection awx.awx.inventory
The function make_request
is used for creating new/updating awx resource AND also used for retrieving existing associations.
So, when a new resource is created and has associations with it, the code will check for existing associations and it will exit right away if it gets a 404 because the self.fail_json() is called when a 404 is received. awx/awx_collection/plugins/module_utils/controller_api.py at a70b0c1ddc35a03701372d0a921fba5bb14264f5 · ansible/awx · GitHub
For example, when I create a new constructed inventory,
- It first makes a POST to create the constructed inventory
- Makes a get request to retrieve all endpoints (existing associations)
Fails with error below
“msg”: “The requested object could not be found at /api/v2/constructed_inventories/24/input_inventories/”
args used below: (with AWX → UI version=22.0.0, Operator=2.0.0)
{
"ANSIBLE_MODULE_ARGS": {
"_ansible_check_mode": false,
"_ansible_debug": false,
"_ansible_diff": false,
"_ansible_ignore_unknown_opts": false,
"_ansible_keep_remote_files": true,
"_ansible_module_name": "awx.awx.inventory",
"_ansible_no_log": false,
"_ansible_remote_tmp": "~/.ansible/tmp",
"_ansible_selinux_special_fs": [
"fuse",
"nfs",
"vboxsf",
"ramfs",
"9p",
"vfat"
],
"_ansible_shell_executable": "/bin/sh",
"_ansible_socket": null,
"_ansible_string_conversion_action": "warn",
"_ansible_syslog_facility": "LOG_USER",
"_ansible_target_log_info": null,
"_ansible_tmpdir": "REDACTED",
"_ansible_verbosity": 3,
"_ansible_version": "2.17.1",
"controller_host": "REDACTED",
"input_inventories": [
"REDACTED"
],
"organization": "REDACTED",
"kind": "constructed",
"name": "REDACTED",
"controller_username": "REDACTED",
"controller_password": "REDACTED"
}
}
OR
Maybe the edge case is that builds the url wrong when retrieving the existing associations for a constructed inventory. When I reverse engineer the api call from the UI, it makes a POST request to
https://.com/api/v2/inventories/24/input_inventories/
NOT
https://.com/api/v2/constructed_inventories/24/input_inventories/
Can someone help me with this please with a course of action to take?