Skip to content

Commit 02efaff

Browse files
authored
Merge pull request #153 from opsmill/bdl-20241126-stable-to-dev
Stable to develop mergeback
2 parents 0d205b0 + 85f8915 commit 02efaff

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

changelog/127.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CTL: `schema load` return a proper error message when authentication is missing or when the user doesn't have the permission to update the schema.

infrahub_sdk/schema.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,12 @@ def _validate_load_schema_response(response: httpx.Response) -> SchemaLoadRespon
540540
status = response.json()
541541
return SchemaLoadResponse(hash=status["hash"], previous_hash=status["previous_hash"])
542542

543-
if response.status_code == httpx.codes.BAD_REQUEST:
544-
return SchemaLoadResponse(errors=response.json())
545-
546-
if response.status_code == httpx.codes.UNPROCESSABLE_ENTITY:
543+
if response.status_code in [
544+
httpx.codes.BAD_REQUEST,
545+
httpx.codes.UNPROCESSABLE_ENTITY,
546+
httpx.codes.UNAUTHORIZED,
547+
httpx.codes.FORBIDDEN,
548+
]:
547549
return SchemaLoadResponse(errors=response.json())
548550

549551
response.raise_for_status()

0 commit comments

Comments
 (0)