Details
-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Inventory
-
Labels:None
-
Difficulty:Medium
Description
Начал наблюдать ошибку при попытке просмотреть список интерфейсов для некоторых объектов (этот трейс для объекта отличного от NOC-846)
UNHANDLED EXCEPTION (2012-11-19 21:16:56.163946) Working directory: /opt/noc <class 'mongoengine.base.ValidationError'> Unable to dereference <class 'noc.inv.models.interface.Interface'>:None START OF TRACEBACK ------------------------------------------------------------------------ File: /opt/noc/lib/nosql.py (Line: 131) Function: convert 124 def __get__(self, instance, owner): 125 def convert(value): 126 if isinstance(value, ObjectId): 127 # Dereference 128 v = self.document_type.objects(id=value).first() 129 if v is None: 130 raise ValidationError("Unable to dereference %s:%s" % ( 131 ==> self.document_type, v)) 132 return v 133 else: 134 return value 135 136 if instance is None: 137 # Document class being used rather than a document object Variables: self = <noc.lib.nosql.PlainReferenceListField object at 0x807ca8f90> value = ObjectId('4eddc5ddf3b6825b8c001891') v = None ------------------------------------------------------------------------ File: /opt/noc/lib/nosql.py (Line: 143) Function: __get__ 136 if instance is None: 137 # Document class being used rather than a document object 138 return self 139 # Get value from document instance if available 140 value = instance._data.get(self.name) 141 # Dereference DBRefs 142 if value is not None: 143 ==> instance._data[self.name] = [convert(v) for v in value] 144 return super(PlainReferenceField, self).__get__(instance, owner) 145 146 def to_mongo(self, document): 147 def convert(value): 148 if isinstance(value, Document): 149 # We need the id from the saved object to create the DBRef Variables: convert = <function convert at 0x809384758> self = <noc.lib.nosql.PlainReferenceListField object at 0x807ca8f90> value = [ObjectId('4eddc560f3b6825b8c0016c9'), ObjectId('4eddc5ddf3b6825b8c001891')] instance = repr() failed v = ObjectId('4eddc5ddf3b6825b8c001891') owner = <class 'noc.inv.models.link.Link'> ------------------------------------------------------------------------ File: /opt/noc/inv/models/link.py (Line: 41) Function: is_ptp 34 35 @property 36 def is_ptp(self): 37 """ 38 Check link is point-to-point link 39 :return: 40 """ 41 ==> return len(self.interfaces) == 2 42 43 @property 44 def is_lag(self): 45 """ 46 Check link is unresolved LAG 47 :return: Variables: self = repr() failed ------------------------------------------------------------------------ File: /opt/noc/inv/apps/interface/views.py (Line: 64) Function: get_link 57 else: 58 return "" 59 60 def get_link(i): 61 link = i.link 62 if not link: 63 return None 64 ==> if link.is_ptp: 65 # ptp 66 o = link.other_ptp(i) 67 label = "%s:%s" % (o.managed_object.name, o.name) 68 elif link.is_lag: 69 # unresolved LAG 70 o = [ii for ii in link.other(i) Variables: i = <Interface: cat-30: Te 1/30> link = repr() failed ------------------------------------------------------------------------ File: /opt/noc/inv/apps/interface/views.py (Line: 107) Function: api_get_interfaces 100 "link": get_link(i), 101 "profile": str(i.profile.id) if i.profile else None, 102 "profile__label": unicode(i.profile) if i.profile else None, 103 "enabled_protocols": i.enabled_protocols, 104 "row_class": get_style(i) 105 } for i in 106 Interface.objects.filter(managed_object=o.id, 107 ==> type="physical") 108 ] 109 # LAG 110 lag = [ 111 { 112 "name": i.name, 113 "description": i.description, Variables: get_style = <function get_style at 0x809384e60> i = <Interface: cat-30: Te 1/30> self = <noc.inv.apps.interface.views.InterfaceAppplication object at 0x8086716d0> get_link = <function get_link at 0x8093842a8> request = <WSGIRequest path:/inv/interface/269/, GET:<QueryDict: {u'_dc': [u'1353345416624']}>, POST:<QueryDict: {}>, COOKIES:{'csrftoken': '102bc6e214b4272a803d0c0a1dd106aa', 'sessionid': 'bf26834d145b7b97dbd60781c3be57f2'}, META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5', 'HTTP_CONNECTION': 'close', 'HTTP_COOKIE': 'sessionid=bf26834d145b7b97dbd60781c3be57f2; csrftoken=102bc6e214b4272a803d0c0a1dd106aa', 'HTTP_DNT': '1', 'HTTP_HOST': '127.0.0.1:8000', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0', 'PATH_INFO': u'/inv/interface/269/', 'QUERY_STRING': '_dc=1353345416624', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': u'', 'SERVER_NAME': '127.0.0.1', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.0', 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x8044bb0c0>, 'wsgi.input': <_io.BytesIO object at 0x809d75710>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> managed_object = u'269' o = <ManagedObject: cat-30> style_cache = {ObjectId('5007f62bf3b682763c000001'): u'noc-color-8', ObjectId('5007f58ff3b6827566000000'): '', ObjectId('5073c24af3b6824c98000000'): u'noc-color-10'} sorted_iname = <function sorted_iname at 0x809384de8> ------------------------------------------------------------------------ File: /opt/noc/lib/app/site.py (Line: 232) Function: inner 225 for k, v in request.POST.lists()) 226 elif request.method == "GET": 227 a = dict((k, v[0] if len(v) == 1 else v) 228 for k, v in request.GET.lists()) 229 logging.debug("API %s %s %s" % (request.method, 230 request.path, a)) 231 # Call handler 232 ==> r = v(request, *args, **kwargs) 233 # Dump SQL statements 234 if self.log_sql_statements: 235 from django.db import connections 236 tsc = 0 237 sc = defaultdict(int) 238 for conn in connections.all(): Variables: args = () view_map = {'GET': <bound method InterfaceAppplication.api_get_interfaces of <noc.inv.apps.interface.views.InterfaceAppplication object at 0x8086716d0>>} Form = <class 'django.forms.forms.Form'> DictParameter = <class 'noc.sa.interfaces.base.DictParameter'> self = <noc.lib.app.site.Site object at 0x8066e2210> v = <bound method InterfaceAppplication.api_get_interfaces of <noc.inv.apps.interface.views.InterfaceAppplication object at 0x8086716d0>> request = <WSGIRequest path:/inv/interface/269/, GET:<QueryDict: {u'_dc': [u'1353345416624']}>, POST:<QueryDict: {}>, COOKIES:{'csrftoken': '102bc6e214b4272a803d0c0a1dd106aa', 'sessionid': 'bf26834d145b7b97dbd60781c3be57f2'}, META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5', 'HTTP_CONNECTION': 'close', 'HTTP_COOKIE': 'sessionid=bf26834d145b7b97dbd60781c3be57f2; csrftoken=102bc6e214b4272a803d0c0a1dd106aa', 'HTTP_DNT': '1', 'HTTP_HOST': '127.0.0.1:8000', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0', 'PATH_INFO': u'/inv/interface/269/', 'QUERY_STRING': '_dc=1353345416624', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': u'', 'SERVER_NAME': '127.0.0.1', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.0', 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x8044bb0c0>, 'wsgi.input': <_io.BytesIO object at 0x809d75710>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> to_log_api_call = False InterfaceTypeError = <class 'noc.sa.interfaces.base.InterfaceTypeError'> PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'> kwargs = {'managed_object': u'269'} app = <noc.inv.apps.interface.views.InterfaceAppplication object at 0x8086716d0> ------------------------------------------------------------------------ END OF TRACEBACK