Auto-commit local changes before build (2026-01-19 13:15:08)

This commit is contained in:
Ivo Oskamp 2026-01-19 13:15:08 +01:00
parent 07e6630a89
commit d5e3734b35
3 changed files with 24 additions and 2 deletions

View File

@ -1 +1 @@
v20260119-04-autotask-ticket-registration
v20260119-05-autotask-create-itemid

View File

@ -414,7 +414,10 @@ class AutotaskClient:
raise AutotaskError("Ticket payload is empty.")
data = self._request("POST", "Tickets", json_body=payload)
# Autotask commonly returns the created object or an items list.
# Autotask commonly returns only an itemId on create.
# We normalize that into a dict with an "id" key so callers can
# perform a follow-up GET /Tickets/{id} to retrieve the full object
# and the human-facing ticketNumber.
if isinstance(data, dict):
if "item" in data and isinstance(data.get("item"), dict):
return data["item"]
@ -422,6 +425,17 @@ class AutotaskClient:
first = data.get("items")[0]
if isinstance(first, dict):
return first
# Autotask create responses often look like: {"itemId": 12345}
item_id = data.get("itemId")
if item_id is None:
item_id = data.get("itemID")
if item_id is not None:
try:
tid = int(item_id)
except Exception:
tid = 0
if tid > 0:
return {"id": tid}
if "id" in data:
return data
# Fallback: return normalized first item if possible

View File

@ -233,6 +233,14 @@ Changes:
- Added repair/propagation logic so runs that already have an Autotask ticket ID but lack internal linking are corrected automatically.
- Guaranteed that future runs for the same job inherit the existing Autotask and internal ticket associations.
## v20260119-05-autotask-create-itemid
### Changes:
- Updated Autotask ticket creation handling to treat a POST response containing only {"itemId": <id>} as a successful ticket creation.
- Normalized the create response so the returned itemId is mapped internally to a ticket id, ensuring the existing follow-up GET /Tickets/{id} flow is always executed.
- Fixed erroneous failure condition where ticket creation was rejected because Autotask did not return a full ticket object.
- Restored compatibility with Autotasks documented behavior for ticket creation responses.
***
## v0.1.21