Error in VC when using filtering
When using filter by l2 domain there is error:
PROCESS: ./services/web/service.py
VERSION: 22.2
BRANCH: HEAD CHANGESET: ffd11c49
ERROR FINGERPRINT: 33c4e755-9f74-5869-899d-ba99125936ed
WORKING DIRECTORY: /opt/noc
EXCEPTION: <class 'mongoengine.errors.InvalidQueryError'> Cannot resolve field "l2domain"
START OF TRACEBACK
------------------------------------------------------------------------
File: lib/python3.8/site-packages/mongoengine/queryset/transform.py (Line: 93)
Function: query
86 negate = True
87
88 if _doc_cls:
89 # Switch field names to proper names [set in Field(name='foo')]
90 try:
91 fields = _doc_cls._lookup_field(parts)
92 except Exception as e:
93 ==> raise InvalidQueryError(e)
94 parts = []
95
96 CachedReferenceField = _import_class("CachedReferenceField")
97 GenericReferenceField = _import_class("GenericReferenceField")
98
99 cleaned_fields = []
Variables:
_doc_cls = <class 'noc.vc.models.vlan.VLAN'>
kwargs = {'l2domain': '6267b96aba25df9fa09c1ea2'}
mongo_query = {}
merge_query = defaultdict(<class 'list'>, {})
key = 'l2domain'
value = '6267b96aba25df9fa09c1ea2'
parts = ['l2domain']
indices = []
op = None
negate = False
------------------------------------------------------------------------
File: lib/python3.8/site-packages/mongoengine/queryset/visitor.py (Line: 80)
Function: visit_query
73 def visit_combination(self, combination):
74 operator = "$and"
75 if combination.operation == combination.OR:
76 operator = "$or"
77 return {operator: combination.children}
78
79 def visit_query(self, query):
80 ==> return transform.query(self.document, **query.query)
81
82
83 class QNode:
84 """Base class for nodes in query trees."""
85
86 AND = 0
Variables:
self =
<mongoengine.queryset.visitor.QueryCompilerVisitor object at 0x7fda6ab055e0>
query = Q(**{'l2domain': '6267b96aba25df9fa09c1ea2'})
------------------------------------------------------------------------
File: lib/python3.8/site-packages/mongoengine/queryset/visitor.py (Line: 184)
Function: accept
177 def __bool__(self):
178 return bool(self.query)
179
180 def __eq__(self, other):
181 return self.__class__ == other.__class__ and self.query == other.query
182
183 def accept(self, visitor):
184 ==> return visitor.visit_query(self)
185
186 @property
187 def empty(self):
188 warn_empty_is_deprecated()
189 return not bool(self.query)
Variables:
self = Q(**{'l2domain': '6267b96aba25df9fa09c1ea2'})
visitor =
<mongoengine.queryset.visitor.QueryCompilerVisitor object at 0x7fda6ab055e0>
------------------------------------------------------------------------
File: lib/python3.8/site-packages/mongoengine/queryset/visitor.py (Line: 91)
Function: to_query
84 """Base class for nodes in query trees."""
85
86 AND = 0
87 OR = 1
88
89 def to_query(self, document):
90 query = self.accept(SimplificationVisitor())
91 ==> query = query.accept(QueryCompilerVisitor(document))
92 return query
93
94 def accept(self, visitor):
95 raise NotImplementedError
96
97 def _combine(self, other, operation):
Variables:
self = Q(**{'l2domain': '6267b96aba25df9fa09c1ea2'})
document = <class 'noc.vc.models.vlan.VLAN'>
query = Q(**{'l2domain': '6267b96aba25df9fa09c1ea2'})
------------------------------------------------------------------------
File: lib/python3.8/site-packages/mongoengine/queryset/base.py (Line: 1684)
Function: _query
1677 def __deepcopy__(self, memo):
1678 """Essential for chained queries with ReferenceFields involved"""
1679 return self.clone()
1680
1681 @property
1682 def _query(self):
1683 if self._mongo_query is None:
1684 ==> self._mongo_query = self._query_obj.to_query(self._document)
1685 if self._cls_query:
1686 if "_cls" in self._mongo_query:
1687 self._mongo_query = {"$and": [self._cls_query, self._mongo_query]}
1688 else:
1689 self._mongo_query.update(self._cls_query)
1690 return self._mongo_query
Variables:
self = repr() failed
------------------------------------------------------------------------
File: lib/python3.8/site-packages/mongoengine/queryset/base.py (Line: 1635)
Function: _cursor
1628 # level, not a cursor level. Thus, we need to get a cloned collection
1629 # object using `with_options` first.
1630 if self._read_preference is not None or self._read_concern is not None:
1631 self._cursor_obj = self._collection.with_options(
1632 read_preference=self._read_preference, read_concern=self._read_concern
1633 ).find(self._query, **self._cursor_args)
1634 else:
1635 ==> self._cursor_obj = self._collection.find(self._query, **self._cursor_args)
1636
1637 # Apply "where" clauses to cursor
1638 if self._where_clause:
1639 where_clause = self._sub_js_fields(self._where_clause)
1640 self._cursor_obj.where(where_clause)
1641
Variables:
self = repr() failed
------------------------------------------------------------------------
File: lib/python3.8/site-packages/mongoengine/queryset/base.py (Line: 177)
Function: __getitem__
170 [<User: User object>, <User: User object>]
171 """
172 queryset = self.clone()
173 queryset._empty = False
174
175 # Handle a slice
176 if isinstance(key, slice):
177 ==> queryset._cursor_obj = queryset._cursor[key]
178 queryset._skip, queryset._limit = key.start, key.stop
179 if key.start and key.stop:
180 queryset._limit = key.stop - key.start
181 if queryset._limit == 0:
182 queryset._empty = True
183
Variables:
self = repr() failed
key = slice(0, 45, None)
queryset = repr() failed
------------------------------------------------------------------------
File: lib/app/extapplication.py (Line: 247)
Function: list_data
240 if grouping:
241 ordering.insert(0, grouping)
242 # Apply row limit if necessary
243 if self.row_limit:
244 limit = min(limit or self.row_limit, self.row_limit + 1)
245 # Apply paging
246 if limit:
247 ==> data = data[start : start + limit]
248 # Fetch and format data
249 out = [formatter(o, fields=only) for o in data]
250 if self.row_limit and len(out) > self.row_limit + 1:
251 return self.response(
252 "System records limit exceeded (%d records)" % self.row_limit, status=self.TOO_LARGE
253 )
Variables:
self =
<noc.services.web.apps.vc.vlan.views.VLANApplication object at 0x7fda6e867100>
request =
<WSGIRequest: GET '/vc/vlan/?_dc=1666009287302&l2domain=6267b96aba25df9fa09c1ea2&__format=ext&__page=1&__start=0&__limit=45'>
q = {'l2domain': '6267b96aba25df9fa09c1ea2'}
limit = 45
start = 0
query = None
ordering = []
grouping = None
fs = None
fav_items = None
xaa = {}
data = repr() failed
unpaged_data = repr() failed
only = None
formatter =
<bound method ExtDocApplication.instance_to_dict_list of <noc.services.web.apps.vc.vlan.views.VLANApplication object at 0x7fda6e867100>>
------------------------------------------------------------------------
File: lib/app/extdocapplication.py (Line: 396)
Function: api_list
389 return r
390
391 def instance_to_lookup(self, o, fields=None):
392 return {"id": str(o.id), "label": smart_text(o)}
393
394 @view(method=["GET"], url=r"^$", access="read", api=True)
395 def api_list(self, request):
396 ==> return self.list_data(request, self.instance_to_dict_list)
397
398 @view(method=["GET"], url=r"^lookup/$", access="lookup", api=True)
399 def api_lookup(self, request):
400 try:
401 return self.list_data(request, self.instance_to_lookup)
402 except ValueError:
Variables:
self =
<noc.services.web.apps.vc.vlan.views.VLANApplication object at 0x7fda6e867100>
request =
<WSGIRequest: GET '/vc/vlan/?_dc=1666009287302&l2domain=6267b96aba25df9fa09c1ea2&__format=ext&__page=1&__start=0&__limit=45'>
------------------------------------------------------------------------
File: lib/app/site.py (Line: 198)
Function: inner
191 a = orjson.loads(request.body)
192 else:
193 a = {k: v[0] if len(v) == 1 else v for k, v in request.POST.lists()}
194 elif request.method == "GET":
195 a = {k: v[0] if len(v) == 1 else v for k, v in request.GET.lists()}
196 app_logger.debug("API %s %s %s", request.method, request.path, a)
197 # Call handler
198 ==> r = v(request, *args, **kwargs)
199 # Dump SQL statements
200 if self.log_sql_statements:
201 from django.db import connections
202
203 tsc = 0
204 sc = defaultdict(int)
Variables:
request =
<WSGIRequest: GET '/vc/vlan/?_dc=1666009287302&l2domain=6267b96aba25df9fa09c1ea2&__format=ext&__page=1&__start=0&__limit=45'>
args = ()
kwargs = {}
v =
<bound method ExtDocApplication.api_list of <noc.services.web.apps.vc.vlan.views.VLANApplication object at 0x7fda6e867100>>
to_log_api_call = False
app_logger = <Logger vc.vlan (INFO)>
nq = <function Site.site_view.<locals>.inner.<locals>.nq at 0x7fda958f25e0>
DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
InterfaceTypeError = <class 'ValueError'>
PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
app =
<noc.services.web.apps.vc.vlan.views.VLANApplication object at 0x7fda6e867100>
self = <noc.lib.app.site.Site object at 0x7fdaa0d153a0>
view_map =
{'GET': <bound method ExtDocApplication.api_list of <noc.services.web.apps.vc.vlan.views.VLANApplication object at 0x7fda6e867100>>,
'POST': <bound method ExtDocApplication.api_create of <noc.services.web.apps.vc.vlan.views.VLANApplication object at 0x7fda6e867100>>}
------------------------------------------------------------------------
END OF TRACEBACK
2022-10-17 15:21:27,329 [django.request] Internal Server Error: /vc/vlan/
2022-10-17 15:21:27,341 [web] [api] 192.168.167.22 misak - "GET /vc/vlan/?_dc=1666009287302&l2domain=6267b96aba25df9fa09c1ea2&__format=ext&__page=1&__start=0&__limit=45" HTTP/1.1 200 "https://noc.management.gnc.am/" Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0 18.93ms