Skip to content

Commit 3a4da61

Browse files
authored
Ensure that nb_app is set before reference (#948)
This is part of an issue with #946 and at least adds more debug info around what endpoint was not found
1 parent 812a0d2 commit 3a4da61

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/module_utils/netbox_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,11 +1054,15 @@ def _find_app(self, endpoint):
10541054
:returns nb_app (str): The application the endpoint lives under
10551055
:params endpoint (str): The endpoint requiring resolution to application
10561056
"""
1057+
nb_app = None
10571058
for k, v in API_APPS_ENDPOINTS.items():
10581059
if endpoint in v:
10591060
nb_app = k
10601061

1061-
return nb_app
1062+
if nb_app:
1063+
return nb_app
1064+
else:
1065+
raise Exception(f"{endpoint} not found in API_APPS_ENDPOINTS")
10621066

10631067
def _find_ids(self, data, user_query_params):
10641068
"""Will find the IDs of all user specified data if resolvable

0 commit comments

Comments
 (0)