Skip to content

fix: register nac, secureConnect, support, users, and assistant categories - #485

Open
priyavrat7 wants to merge 1 commit into
meraki:betafrom
priyavrat7:fix-472-missing-category-registrations
Open

fix: register nac, secureConnect, support, users, and assistant categories#485
priyavrat7 wants to merge 1 commit into
meraki:betafrom
priyavrat7:fix-472-missing-category-registrations

Conversation

@priyavrat7

Copy link
Copy Markdown

Fixes #472

The issue reported that nac is not accessible on DashboardAPI, even though the underlying methods exist and work fine on their own. I traced this to meraki/init.py, which is a hand maintained file, not generated, and is responsible for importing each category class and attaching it to the client. nac was generated under meraki/api/ but never wired into this file.

While checking this, I compared every file under meraki/api/ against what is actually registered in meraki/init.py and found the same gap for four more categories, secureConnect, support, users, and assistant. All five exist as fully working generated code, none were wired up. I found the same issue in the async client, meraki/aio/init.py, and fixed it there too.

I decided to fix all five in this one PR instead of just nac, since it is the same root cause and the same two line fix repeated five times, not five separate bugs. That said, if the team would rather keep this PR scoped to just nac and handle the other four as a separate issue and PR, I am completely fine doing that instead. Happy to split it however works best on your end.

What I think is not in scope here

test_all_api_sections_initialized previously checked only 5 of the 22 registered categories. I extended it to also check the 5 I fixed here, so it now checks 10 of 22. I left the remaining 12 uncovered on purpose, since those were never broken and adding coverage for working code is a separate improvement, not part of this bug fix. I can open a follow up issue for that if it is useful.

There is currently no unit test anywhere in this repo for AsyncDashboardAPI initialization, only integration tests that need a live org. So the async fix here does not have a matching unit test. Wanted to flag that honestly instead of skipping it quietly or building new test infrastructure as part of this PR.

Testing

Reproduced on a clean beta checkout, all five raised AttributeError on both DashboardAPI and AsyncDashboardAPI before the fix
Confirmed all five resolve correctly after the fix, on both clients
Extended test_all_api_sections_initialized and confirmed it fails without the fix with AttributeError, DashboardAPI object has no attribute nac, then passes with it
Also manually confirmed the 12 untouched categories still work fine, on both clients, so this fix does not touch anything outside the five it is meant to
Full unit suite passes, 211 passed
ruff check and ruff format are clean on both edited files aside from a few pre existing issues, confirmed with git blame to predate this change

…ories

These five categories existed as fully working generated code under
meraki/api/ and meraki/aio/api/, but these were not added them to
meraki/__init__.py or meraki/aio/__init__.py. Since that file is the
one place that actually wires a category onto DashboardAPI, calling
dashboard.nac (or any of the other four) just raised AttributeError
even though the code behind it worked fine on its own.

I found this while looking into the nac report specifically, but once
I checked what else might be missing the same wiring, I found four
more categories in the exact same state. Fixed all five here since
it is the same two line pattern each time.

Also extended test_all_api_sections_initialized so these five are
actually checked going forward, since the original version only
checked 5 of the (now) 22 registered categories and that is basically
how this slipped through in the first place.

Fixes meraki#472
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 this pull request may close these issues.

1 participant