ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.97k stars 3.41k forks source link

Change inventory_sources_with_failures to a list of ids #7579

Open keithjgrant opened 4 years ago

keithjgrant commented 4 years ago
ISSUE TYPE
SUMMARY

Currently:

When fetching Inventories, the value inventory_sources_with_failures is currently a count of sources with failures. From a UI perspective, this effectively acts as a boolean (0 or non-zero) to indicate whether the Inventory has a successful (green) sync status or not. When a websocket event shows that an inventory source is updated with a success/failure sync status, the UI does not have enough information to know whether this means the inventory as a whole is now green or red, and additional API calls are required to keep the UI in sync.

Proposed change:

Change inventory_sources_with_failures to list of ids, rather than a count. The UI would be able to add/remove ids to this list in the client and display the Inventory status accurately without making successive calls to the API.

Alternatively, a separate key could be added to the response that includes the list of ids, to avoid a breaking change.

AlanCoding commented 1 year ago

When a websocket event shows that an inventory source is updated with a success/failure sync status, the UI does not have enough information to know whether this means the inventory as a whole is now green or red, and additional API calls are required to keep the UI in sync.

I'm missing some details to fully understand this. If I get a websocket message that an inventory update is successful it looks like

finished: "2023-04-05T14:25:58.035134Z"
group_name: "jobs"
inventory_id: 113
inventory_source_id: 125
status: "successful"
type: "inventory_update"
unified_job_id: 185
unified_job_template_id: 125

This issue seems to imply that you would use the inventory_sources_with_failures to map the inventory source id (unified_job_template_id in this case) to the inventory. I kind of don't get it. Wouldn't you just use the inventory_id to update the failed / successful status of inventories in the list?

Also, there is no way we can say the inventory is green if it has a failed source. That doesn't make any sense to me. If any inventory source in the inventory fails, we have no choice but to mark the inventory is failed because we don't know anything about how critical the source is for the content.