Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: API server should return a propper HTTP status code when loading a schema with a schemanode that references a menu_placement that doesn't exist anymore #4089

Closed
wvandeun opened this issue Aug 13, 2024 · 0 comments
Assignees
Labels
group/schema Issue related to some schemas type/bug Something isn't working as expected

Comments

@wvandeun
Copy link
Contributor

Component

No response

Infrahub version

0.16.0.dev0

Current Behavior

When you load a schema with a schemanode that defines a menu_placement to a schemanode, that previously existed but has been removed, the API server returns a generic HTTP 500 status code.

In the application server logs you find a proper exception indicating the schemanode referenced in the menu_placement is invalid.

Expected Behavior

The API server returns a proper status code (client side issue) with an error message that explains what is wrong.
infrahubctl schema load should then display the error message properly.

Steps to Reproduce

  • load this schema into Infrahub
---
version: "1.0"
nodes:
  - name: ANode
    namespace: Infra
    label: "Anode"
    display_labels:
      - name__value
    attributes:
      - name: name
        kind: Text
        unique: true
  - name: BNode
    namespace: Infra
    menu_placement: "InfraANode"
    label: "BNode"
    display_labels:
      - name__value
    attributes:
      - name: name
        kind: Text
        unique: true
  • update the schema (ANode with state absent)
---
version: "1.0"
nodes:
  - name: ANode
    namespace: Infra
    label: "Anode"
    state: absent
    display_labels:
      - name__value
    attributes:
      - name: name
        kind: Text
        unique: true
  - name: BNode
    namespace: Infra
    menu_placement: "InfraANode"
    label: "BNode"
    display_labels:
      - name__value
    attributes:
      - name: name
        kind: Text
        unique: true
  • load the schema using infrahubctl
  • notice the generic HTTP 500 status code error message
  • the application server logs show the following exception
--- snip ---
ValueError: InfraBNode: InfraANode is not a valid menu placement

Additional Information

No response

@wvandeun wvandeun added the type/bug Something isn't working as expected label Aug 13, 2024
@dgarros dgarros added the group/schema Issue related to some schemas label Aug 13, 2024
@dgarros dgarros added this to the Infrahub - 0.16.1 milestone Aug 21, 2024
@exalate-issue-sync exalate-issue-sync bot added the state/planned This issue is planned to be worked on in an upcoming release. label Sep 9, 2024
@LucasG0 LucasG0 self-assigned this Sep 10, 2024
@LucasG0 LucasG0 closed this as completed Sep 16, 2024
@exalate-issue-sync exalate-issue-sync bot removed the state/planned This issue is planned to be worked on in an upcoming release. label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/schema Issue related to some schemas type/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants