Details
Description
В случае префикса
UNHANDLED EXCEPTION (2012-08-02 20:15:20.354507) Working directory: /opt/noc <type 'exceptions.NameError'> name 'AS' is not defined START OF TRACEBACK ------------------------------------------------------------------------ File: /opt/noc/ip/apps/ipam/views.py (Line: 599) Function: EditPrefixForm 592 def view_change_prefix(self, request, vrf_id, afi, prefix): 593 """ 594 Change prefix 595 """ 596 def get_form_class(): 597 class EditPrefixForm(NOCForm): 598 asn = forms.ModelChoiceField(label=_("ASN"), 599 ==> queryset=AS.objects.order_by("asn"), 600 help_text=_("AS Number")) 601 state = forms.ModelChoiceField(label=_("State"), 602 queryset=ResourceState.objects.filter(is_active=True).order_by("name"), 603 help_text=_("Prefix state") 604 ) 605 if can_bind_vc: Variables: __module__ = 'noc.ip.apps.ipam.views' ------------------------------------------------------------------------ File: /opt/noc/ip/apps/ipam/views.py (Line: 597) Function: get_form_class 590 @view(url=r"^(?P<vrf_id>\d+)/(?P<afi>[46])/(?P<prefix>\S+)/change/$", 591 url_name="change_prefix", access="change") 592 def view_change_prefix(self, request, vrf_id, afi, prefix): 593 """ 594 Change prefix 595 """ 596 def get_form_class(): 597 ==> class EditPrefixForm(NOCForm): 598 asn = forms.ModelChoiceField(label=_("ASN"), 599 queryset=AS.objects.order_by("asn"), 600 help_text=_("AS Number")) 601 state = forms.ModelChoiceField(label=_("State"), 602 queryset=ResourceState.objects.filter(is_active=True).order_by("name"), 603 help_text=_("Prefix state") Variables: afi = u'4' can_bind_vc = True self = <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610> request = <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:{'csrftoken': 'be54bee63dd40803efe11b2cd5b2f9c3', 'sessionid': 'f043013ac7aa78b327d0878cfcc68733'}, META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3', 'HTTP_CONNECTION': 'close', 'HTTP_COOKIE': 'csrftoken=be54bee63dd40803efe11b2cd5b2f9c3; sessionid=f043013ac7aa78b327d0878cfcc68733', 'HTTP_HOST': '127.0.0.1:8000', 'HTTP_REFERER': 'http://noc/ip/ipam/12/4/xxx/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1', 'PATH_INFO': u'/ip/ipam/12/4/xxx/change/', 'QUERY_STRING': '', '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 0x8040f25d0>, 'wsgi.input': <_io.BytesIO object at 0x80949cf50>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> prefix = <Prefix: Global(4): xxx> vrf = <VRF: global> ------------------------------------------------------------------------ File: /opt/noc/ip/apps/ipam/views.py (Line: 662) Function: view_change_prefix 655 if ((afi == "4" and not vrf.afi_ipv4) or 656 (afi == "6" and not vrf.afi_ipv6)): 657 return self.response_forbidden("Invalid AFI") 658 if not PrefixAccess.user_can_change(request.user, vrf, afi, prefix): 659 return self.response_forbidden() 660 prefix = self.get_object_or_404(Prefix, vrf=vrf, afi=afi, prefix=prefix) 661 can_bind_vc = Permission.has_perm(request.user, "ip:ipam:bind_vc") 662 ==> form_class = get_form_class() 663 if request.POST: 664 # Save prefix 665 form = form_class(request.POST) 666 if form.is_valid(): 667 for k, v in form.cleaned_data.items(): 668 if ((not can_bind_vc and k == "vc") or Variables: afi = u'4' can_bind_vc = True get_form_class = <function get_form_class at 0x809447320> request = <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:{'csrftoken': 'be54bee63dd40803efe11b2cd5b2f9c3', 'sessionid': 'f043013ac7aa78b327d0878cfcc68733'}, META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3', 'HTTP_CONNECTION': 'close', 'HTTP_COOKIE': 'csrftoken=be54bee63dd40803efe11b2cd5b2f9c3; sessionid=f043013ac7aa78b327d0878cfcc68733', 'HTTP_HOST': '127.0.0.1:8000', 'HTTP_REFERER': 'http://noc/ip/ipam/12/4/xxx/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1', 'PATH_INFO': u'/ip/ipam/12/4/xxx/change/', 'QUERY_STRING': '', '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 0x8040f25d0>, 'wsgi.input': <_io.BytesIO object at 0x80949cf50>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> prefix = <Prefix: Global(4): xxx> vrf = <VRF: global> vrf_id = u'12' self = <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610> ------------------------------------------------------------------------ File: /opt/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 = {'PUT': <bound method IPAMAppplication.view_change_prefix of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>>, 'POST': <bound method IPAMAppplication.view_change_prefix of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>>, 'GET': <bound method IPAMAppplication.view_change_prefix of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>>, 'DELETE': <bound method IPAMAppplication.view_change_prefix of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>>} Form = <class 'django.forms.forms.Form'> DictParameter = <class 'noc.sa.interfaces.base.DictParameter'> self = <noc.lib.app.site.Site object at 0x806382150> v = <bound method IPAMAppplication.view_change_prefix of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>> request = <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:{'csrftoken': 'be54bee63dd40803efe11b2cd5b2f9c3', 'sessionid': 'f043013ac7aa78b327d0878cfcc68733'}, META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3', 'HTTP_CONNECTION': 'close', 'HTTP_COOKIE': 'csrftoken=be54bee63dd40803efe11b2cd5b2f9c3; sessionid=f043013ac7aa78b327d0878cfcc68733', 'HTTP_HOST': '127.0.0.1:8000', 'HTTP_REFERER': 'http://noc/ip/ipam/12/4/xxx/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1', 'PATH_INFO': u'/ip/ipam/12/4/xxx/change/', 'QUERY_STRING': '', '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 0x8040f25d0>, 'wsgi.input': <_io.BytesIO object at 0x80949cf50>, '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 = {'vrf_id': u'12', 'prefix': u'xxx', 'afi': u'4'} app = <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610> ------------------------------------------------------------------------ END OF TRACEBACK
В случае адреса
UNHANDLED EXCEPTION (2012-08-02 20:17:10.502418) Working directory: /opt/noc <type 'exceptions.NameError'> name 'ResourceState' is not defined START OF TRACEBACK ------------------------------------------------------------------------ File: /opt/noc/ip/apps/ipam/views.py (Line: 759) Function: AddressForm 752 state = forms.ModelChoiceField( 753 label=_("State"), 754 queryset=ResourceState.objects.filter(is_starting=True, is_active=True).order_by("name"), 755 help_text=_("Prefix state") 756 ) 757 else: 758 state = forms.ModelChoiceField(label=_("State"), 759 ==> queryset=ResourceState.objects.filter(is_active=True).order_by("name"), 760 help_text=_("Prefix state") 761 ) 762 fqdn = forms.CharField(label=_("FQDN"), validators=[check_fqdn]) 763 mac = forms.CharField(label=_("MAC"), required=False) 764 auto_update_mac = forms.BooleanField( 765 label=_("Auto-update MAC"), Variables: __module__ = 'noc.ip.apps.ipam.views' address = <django.forms.fields.CharField object at 0x8092b4310> ------------------------------------------------------------------------ File: /opt/noc/ip/apps/ipam/views.py (Line: 747) Function: get_address_form_class 740 # Display form 741 return self.render(request, "delete_prefix.html", prefix=prefix) 742 743 ## 744 ## Return address edit/change form 745 ## 746 def get_address_form_class(self, vrf, afi, user, create=False): 747 ==> class AddressForm(NOCForm): 748 address = forms.CharField(label=_("Address"), 749 help_text=_("IPv%(afi)s address") % { 750 "afi": afi}) 751 if create: 752 state = forms.ModelChoiceField( 753 label=_("State"), Variables: vrf = <VRF: global> create = False user = <User: iz> self = <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610> afi = u'4' ------------------------------------------------------------------------ File: /opt/noc/ip/apps/ipam/views.py (Line: 960) Function: view_change_address 953 return self.response_forbidden("Invalid AFI") 954 address = self.get_object_or_404(Address, vrf=vrf, afi=afi, 955 address=address) 956 if not PrefixAccess.user_can_change(request.user, vrf, afi, 957 address.address): 958 return self.response_forbidden() 959 prefix = address.prefix 960 ==> form_class = self.get_address_form_class(vrf, afi, request.user) 961 if request.POST: 962 form = form_class(request.POST) 963 if form.is_valid(): 964 # Check not in locked range 965 if AddressRange.address_is_locked(vrf, afi, 966 form.cleaned_data["address"]): Variables: afi = u'4' self = <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610> request = <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:{'csrftoken': 'be54bee63dd40803efe11b2cd5b2f9c3', 'sessionid': 'f043013ac7aa78b327d0878cfcc68733'}, META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3', 'HTTP_CONNECTION': 'close', 'HTTP_COOKIE': 'csrftoken=be54bee63dd40803efe11b2cd5b2f9c3; sessionid=f043013ac7aa78b327d0878cfcc68733', 'HTTP_HOST': '127.0.0.1:8000', 'HTTP_REFERER': 'http://noc/ip/ipam/12/4/xxx/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1', 'PATH_INFO': u'/ip/ipam/12/4/yyy/change_address/', 'QUERY_STRING': '', '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 0x8040f25d0>, 'wsgi.input': <_io.BytesIO object at 0x809253410>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> prefix = <Prefix: Global(4): xxx> vrf = <VRF: global> address = <Address: Global(4): yyy> vrf_id = u'12' ------------------------------------------------------------------------ File: /opt/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 = {'PUT': <bound method IPAMAppplication.view_change_address of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>>, 'POST': <bound method IPAMAppplication.view_change_address of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>>, 'GET': <bound method IPAMAppplication.view_change_address of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>>, 'DELETE': <bound method IPAMAppplication.view_change_address of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>>} Form = <class 'django.forms.forms.Form'> DictParameter = <class 'noc.sa.interfaces.base.DictParameter'> self = <noc.lib.app.site.Site object at 0x806382150> v = <bound method IPAMAppplication.view_change_address of <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610>> request = <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:{'csrftoken': 'be54bee63dd40803efe11b2cd5b2f9c3', 'sessionid': 'f043013ac7aa78b327d0878cfcc68733'}, META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3', 'HTTP_CONNECTION': 'close', 'HTTP_COOKIE': 'csrftoken=be54bee63dd40803efe11b2cd5b2f9c3; sessionid=f043013ac7aa78b327d0878cfcc68733', 'HTTP_HOST': '127.0.0.1:8000', 'HTTP_REFERER': 'http://noc/ip/ipam/12/4/xxx/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1', 'PATH_INFO': u'/ip/ipam/12/4/yyy/change_address/', 'QUERY_STRING': '', '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 0x8040f25d0>, 'wsgi.input': <_io.BytesIO object at 0x809253410>, '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 = {'vrf_id': u'12', 'afi': u'4', 'address': u'yyy'} app = <noc.ip.apps.ipam.views.IPAMAppplication object at 0x80918c610> ------------------------------------------------------------------------ END OF TRACEBACK