apache / apache/cloudstack

Improve Template/ISO Failure Status and Error Reporting

Offen
#11,326 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
component:templates
Vorherrschende Sprache
Java
Sterne
3.1k
Forks
1.4k
Ø Merge
6 T. 19 Std.
Gemergte PRs (30 T.)
32

Beschreibung

### The required feature described as a wish

**Description:**
In the ISO/Templates flow, error responses currently return detailed error messages directly in the status field. This leads to inconsistencies and complicates error handling.

**Proposal:**
Introduce two improvements to the API responses for Templates and ISOs:

1) Standardize the `status` Field for Failures
When any terminal error occurs during the processing of a template or ISO, the `status` field should consistently return `"Failed"`. This provides a clear and unambiguous final state for parsing.

2) Add a Detailed Error Message Field
A new field, named `error_details`, should be added to the Template/ISO API response object.
This field will contain a detailed error string explaining the reason for the failure.

**Example of the response**
Failed download status of the ISO/Template:
```
{
"id": "a1b2c3d4-xxxx-yyyy-zzzz-e5f6g7h8i9j0",
"name": "my-failed-template",
"status": "Failed",
"error_details": "HTTP Server returned 404 (expected 200 OK)",
....
}
```
Successful download status of the ISO/Template:
```
{
"id": "b1b2c3d4-xxxx-yyyy-zzzz-e5f6g7h8i9j1",
"name": "my-template",
"status": "Download Complete",
"error_details": null,
....
}
```
**Benefits:**
- Consistent error structure across ISO/Templates;
- Easier parsing, logging, and UI display of error messages;
- Avoids issues caused by leading/trailing spaces or unexpected values in status.

Tasks:
1) Update ISO/Templates logic to return "Failed" in the `status` field.
2) Return detailed error messages in the `error_details` field.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, die Verarbeitung der ISO/Templates-API-Antworten und die im Issue beschriebenen terminalen Fehlerpfade nachzuverfolgen. Überprüfe jede Fehlerantwort und die erfolgreiche Download-Antwort. Stelle anschließend sicher, dass Fehler "Failed" mit der detaillierten Nachricht in error_details verwenden und erfolgreiche Antworten einen null-Wert für error_details verwenden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
api, cloud
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.