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: Error during a menu load when Parent referenced a Kind instead of a #4826

Open
BeArchiTek opened this issue Nov 1, 2024 · 0 comments
Open
Assignees
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/bug Something isn't working as expected

Comments

@BeArchiTek
Copy link
Contributor

Component

No response

Infrahub version

1.0.0

Current Behavior

When attempting to add VLANs to the IPAM using the BuiltinIPAM menu item in infrahubctl, the following error appears:

['CoreMenuItemUpsert'] Unable to find the node BuiltinIPAM / CoreMenu in the database.

This occurs when setting BuiltinIPAM as the parent in the menu YAML file, as shown below:

---
apiVersion: infrahub.app/v1
kind: Menu
spec:
  data:
    # Adding VLANs to IPAM
    - name: VLAN
      namespace: Infra
      label: VLANs
      icon: "mdi:lan-pending"
      kind: InfraVLAN
      parent: BuiltinIPAM

However, using a different structure for parent as an array, like ["Builtin", "IPAM"], appears to work without errors:

    # Adding VLANs to IPAM
    - name: VLAN
      namespace: Infra
      label: VLANs
      icon: "mdi:lan-pending"
      kind: InfraVLAN
      parent: ["Builtin", "IPAM"]

Expected Behavior

According to the documentation, the parent field should accept a string in the format of concatenated namespace + name, meaning BuiltinIPAM should work as the value without requiring an array format. The parent field should recognize BuiltinIPAM directly, aligning with the documented behavior.

Documentation Reference: https://docs.infrahub.app/reference/menu

parent string: a parent menu item (concatenated namespace + name)

Steps to Reproduce

  1. Create a YAML file (file.yml) with the menu configuration:
apiVersion: infrahub.app/v1
kind: Menu
spec:
  data:
    - name: VLAN
      namespace: Infra
      label: VLANs
      icon: "mdi:lan-pending"
      kind: InfraVLAN
      parent: BuiltinIPAM
  1. Attempt to load the menu using:
infrahubctl menu load file.yml
  1. Observe the error:
['CoreMenuItemUpsert'] Unable to find the node BuiltinIPAM / CoreMenu in the database.
  1. Update the parent field to use the array format:
      parent: ["Builtin", "IPAM"]
  1. Reload the menu and note that it works without errors.

Additional Information

No response

@BeArchiTek BeArchiTek added the type/bug Something isn't working as expected label Nov 1, 2024
@dgarros dgarros added the group/backend Issue related to the backend (API Server, Git Agent) label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants