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

Missing lo0 parent should have a better error message #23

Open
loulecrivain opened this issue Aug 9, 2024 · 3 comments · May be fixed by #30
Open

Missing lo0 parent should have a better error message #23

loulecrivain opened this issue Aug 9, 2024 · 3 comments · May be fixed by #30
Assignees

Comments

@loulecrivain
Copy link
Contributor

Currently we have this error when a device has no lo0 parent:

Info: Generating trma2061
Traceback (most recent call last):
  File "/nix/store/qfn07kpir8wbmcjykzi3xl6rlhh8rhhh-python3.11-cosmo-0.8.4/bin/.cosmo-wrapped", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "/nix/store/qfn07kpir8wbmcjykzi3xl6rlhh8rhhh-python3.11-cosmo-0.8.4/lib/python3.11/site-packages/cosmo/__main__.py", line 80, in main
    serializer = RouterSerializer(device, cosmo_data['l2vpn_list'], cosmo_data["vrf_list"])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qfn07kpir8wbmcjykzi3xl6rlhh8rhhh-python3.11-cosmo-0.8.4/lib/python3.11/site-packages/cosmo/serializer.py", line 36, in __init__
    match device["platform"]["manufacturer"]["slug"]:
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

we should introduce a better error message for this specific case, such as the operator can quickly identify the issue and correct it from the datasource

also, a test case would be needed to make sure future refactoring does not omit this.

@loulecrivain loulecrivain self-assigned this Aug 9, 2024
@johannwagner
Copy link
Contributor

I am thinking about refactoring Errors all along. Introducing a DeviceError which can get caught on device loop level and gets the device ignored and the error message printed, a InterfaceError for the interface loop which gets the interface ignored and a FatalError which stops execution and does not create artifacts.

@loulecrivain
Copy link
Contributor Author

loulecrivain commented Aug 12, 2024

Do we want to wait until we start refactoring everything, or do you want to implement it now ?

There's only one portion of the RouterSerializer for which we still have to write tests (QoS stuff iirc), but idk how urgent this change is, and if we can wait for the refactor to be completed.

@johannwagner
Copy link
Contributor

Include a print error message for now and we will rework it later.

@loulecrivain loulecrivain linked a pull request Sep 16, 2024 that will close this issue
3 tasks
@loulecrivain loulecrivain linked a pull request Sep 16, 2024 that will close this issue
3 tasks
loulecrivain added a commit that referenced this issue Sep 16, 2024
- further checks regarding manufacturer slug
- test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants