Skip to content

Commit a5486dc

Browse files
committed
fix: support both positional and keyword argument for query parameter
Per review feedback, the lookup now accepts query as either: - Positional: query('networktocode.nautobot.lookup_graphql', query_string, ...) - Keyword: query('networktocode.nautobot.lookup_graphql', query=query_string, ...)
1 parent 0c8019e commit a5486dc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

plugins/lookup/lookup_graphql.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,11 @@ def run(self, terms, variables=None, graph_variables=None, **kwargs):
222222
)
223223

224224
# Terms comes in as a list, this needs to be moved to string for pynautobot
225+
# Support both positional argument (terms) and keyword argument (query=)
226+
query = terms[0] if terms else kwargs.get("query")
227+
225228
lookup_info = nautobot_lookup_graphql(
226-
query=terms[0], variables=variables, graph_variables=graph_variables, **kwargs
229+
query=query, variables=variables, graph_variables=graph_variables, **kwargs
227230
)
228231

229232
# Results should be the data response of the query to be returned as a lookup

0 commit comments

Comments
 (0)