Details
Description
после удаления базы mongo и переустановки NOC перестал работать Inventory-Interfaces. А именно - при обращении к object выпадает окно с ошибкой "Failed to get interfaces"
Если зайти по адресу https://noc.localhost.com.ua/inv/interface/39/?_dc=1343136295140
(/inv/interface/39/?_dc=1343136295140 - взято из логов noc-web.log)
выдает ошибку
UNHANDLED EXCEPTION (2012-07-24 16:33:19.590361) Working directory: /var/backups/noc <type 'exceptions.AttributeError'> 'NoneType' object has no attribute 'id' START OF TRACEBACK ------------------------------------------------------------------------ File: /var/backups/noc/inv/apps/interface/views.py (Line: 106) Function: api_get_interfaces 99 if i.aggregated_interface else ""), 100 "link": get_link(i), 101 "profile": str(i.profile.id), 102 "profile__label": unicode(i.profile), 103 "row_class": get_style(i) 104 } for i in 105 Interface.objects.filter(managed_object=o.id, 106 ==> type="physical") 107 ] 108 # LAG 109 lag = [ 110 { 111 "name": i.name, 112 "description": i.description, Variables: get_style = <function get_style at 0x46a8320> i = <Interface: 6850-u24x: 1/1> self = <noc.inv.apps.interface.views.InterfaceAppplication object at 0x3b67b90> get_link = <function get_link at 0x46a8410> request = <WSGIRequest GET:<QueryDict: {u'_dc': [u'1343136295140']}>, POST:<QueryDict: {}>, COOKIES:{'csrftoken': 'dea580f20ab496bf17993df0d29cfa02', 'sessionid': 'd5ce9a1d77217a000d5a6ed285d56ed1'}, META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'windows-1251,utf-8;q=0.7,*;q=0.3', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch', 'HTTP_ACCEPT_LANGUAGE': 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4', 'HTTP_CONNECTION': 'Keep-Alive', 'HTTP_COOKIE': 'sessionid=d5ce9a1d77217a000d5a6ed285d56ed1; csrftoken=dea580f20ab496bf17993df0d29cfa02', 'HTTP_HOST': 'localhost:8000', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11', 'HTTP_X_FORWARDED_FOR': '10.100.100.101', 'HTTP_X_FORWARDED_HOST': 'noc.sunline.ua', 'HTTP_X_FORWARDED_SERVER': 'noc.sunline.ua', 'PATH_INFO': u'/inv/interface/39/', 'QUERY_STRING': '_dc=1343136295140', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': u'', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.1', 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x1cc7420>, 'wsgi.input': <io.BytesIO object at 0x460de90>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> managed_object = u'39' o = <ManagedObject: 6850-u24x> style_cache = {} _[1] = [] sorted_iname = <function sorted_iname at 0x46a8398> ------------------------------------------------------------------------ File: /var/backups/noc/lib/app/site.py (Line: 226) Function: inner 219 for k, v in request.POST.lists()) 220 elif request.method == "GET": 221 a = dict((k, v[0] if len(v) == 1 else v) 222 for k, v in request.GET.lists()) 223 logging.debug("API %s %s %s" % (request.method, 224 request.path, a)) 225 # Call handler 226 ==> r = v(request, *args, **kwargs) 227 # Dump SQL statements 228 if self.log_sql_statements: 229 from django.db import connections 230 tsc = 0 231 sc = defaultdict(int) 232 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 0x3b67b90>>} Form = <class 'django.forms.forms.Form'> DictParameter = <class 'noc.sa.interfaces.base.DictParameter'> self = <noc.lib.app.site.Site object at 0x238c410> v = <bound method InterfaceAppplication.api_get_interfaces of <noc.inv.apps.interface.views.InterfaceAppplication object at 0x3b67b90>> request = <WSGIRequest GET:<QueryDict: {u'_dc': [u'1343136295140']}>, POST:<QueryDict: {}>, COOKIES:{'csrftoken': 'dea580f20ab496bf17993df0d29cfa02', 'sessionid': 'd5ce9a1d77217a000d5a6ed285d56ed1'}, META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'windows-1251,utf-8;q=0.7,*;q=0.3', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch', 'HTTP_ACCEPT_LANGUAGE': 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4', 'HTTP_CONNECTION': 'Keep-Alive', 'HTTP_COOKIE': 'sessionid=d5ce9a1d77217a000d5a6ed285d56ed1; csrftoken=dea580f20ab496bf17993df0d29cfa02', 'HTTP_HOST': 'localhost:8000', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11', 'HTTP_X_FORWARDED_FOR': '10.100.100.101', 'HTTP_X_FORWARDED_HOST': 'noc.sunline.ua', 'HTTP_X_FORWARDED_SERVER': 'noc.sunline.ua', 'PATH_INFO': u'/inv/interface/39/', 'QUERY_STRING': '_dc=1343136295140', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': u'', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.1', 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x1cc7420>, 'wsgi.input': <io.BytesIO object at 0x460de90>, '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'39'} app = <noc.inv.apps.interface.views.InterfaceAppplication object at 0x3b67b90> ------------------------------------------------------------------------ END OF TRACEBACK
в рабочем варианте выдавалось следующее
{"lag": [], "l2": [{"tagged_vlans": [], "name": "Gi 0/1", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/2", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/3", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/4", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/5", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/6", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/7", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/8", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/9", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/11", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/12", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/13", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/14", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/15", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/16", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/17", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/18", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/19", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/20", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/21", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/22", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/23", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Gi 0/24", "untagged_vlan": null, "description": null}, {"tagged_vlans": [], "name": "Te 1/1", "untagged_vlan": null, "description": null}], "l3": [], "l1": [{"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4d39402051361d000002", "label": "GOR_8:Eth 1/9"}, "name": "Gi 0/1", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000000", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4d51402051361e000008", "label": "GOR_43:Eth 1/9"}, "name": "Gi 0/2", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000002", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4d61402051361e000009", "label": "GOR_35:Eth 1/9"}, "name": "Gi 0/3", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000004", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4d70402051361e00000a", "label": "GOR_28:Eth 1/9"}, "name": "Gi 0/4", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000006", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4d80402051361e00000b", "label": "IND_67:Eth 1/9"}, "name": "Gi 0/5", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000008", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4d93402051361e00000c", "label": "IND_76:Eth 1/9"}, "name": "Gi 0/6", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b00000a", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/7", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b00000c", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/8", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b00000e", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/9", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000010", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/11", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000012", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/12", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000014", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4e57402051361d000003", "label": "V1_KIR_16:Eth 1/9"}, "name": "Gi 0/13", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000016", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/14", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000018", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4e94402051361d000004", "label": "V23_LIS_25:Eth 1/9"}, "name": "Gi 0/15", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b00001a", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4ea9402051361d000005", "label": "V23_LIS_40:Eth 1/9"}, "name": "Gi 0/16", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b00001c", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4ebb402051361d000006", "label": "SL_3:Eth 1/9"}, "name": "Gi 0/17", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b00001e", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/18", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000020", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/19", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000022", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d4ee4402051361e00000d", "label": "V23_GUT_25:Eth 1/9"}, "name": "Gi 0/20", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000024", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/21", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000026", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/22", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b000028", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/23", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b00002a", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": null, "name": "Gi 0/24", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b00002c", "description": null}, {"profile": "5008192b402051206c000000", "row_class": "", "mac": "00:21:91:C7:D6:F8", "link": {"id": "500d49024020513615000002", "label": "6850-u24x:1/25"}, "name": "Te 1/1", "profile__label": "default", "ifindex": null, "lag": "", "id": "500d4589402051394b00002e", "description": null}]}