igordobrinin

noc ipam post fail

Nov 27th, 2020 (edited)
818
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #http --verify=no  --print=HhBb --json -a div:****** POST https://noc.****/ip/prefix/ prefix=10.248.32.4/30
  2.  
  3. {
  4.     "prefix": "10.248.32.4/30"
  5. }
  6.  
  7. HTTP/1.1 500 Internal Server Error
  8. Cache-Control: no-cache
  9. Connection: keep-alive
  10. Content-Length: 6953
  11. Content-Type: text/plain; charset=utf-8
  12. Date: Fri, 27 Nov 2020 08:25:26 GMT
  13. Expires: 0
  14. Pragma: no-cache
  15. Server: nginx/1.18.0
  16. X-Backend-Server: 172.16.10.157:38621
  17. X-Front-Server: noc.maria-ra.ru
  18. X-Noc-Backend: fc673f20-e0b8-4f72-a913-48e4737cadc6 (172.16.10.157:38621)
  19.  
  20. UNHANDLED EXCEPTION (2020-11-27 11:25:26.036635)
  21. PROCESS: ./services/web/service.py
  22. VERSION: latest-20.3
  23. BRANCH: HEAD CHANGESET: 0d9729ba
  24. ERROR FINGERPRINT: 2243e8b1-52ba-5c1a-9510-e05d7abd52af
  25. WORKING DIRECTORY: /opt/noc
  26. EXCEPTION: <class 'noc.ip.models.prefixprofile.DoesNotExist'>
  27. START OF TRACEBACK
  28. ------------------------------------------------------------------------
  29. File: core/model/fields.py (Line: 244)
  30. Function: __get__
  31.   237                 return getattr(instance, self.cache_name)
  32.   238             except AttributeError:
  33.   239                 val = instance.__dict__.get(self.name) or None
  34.   240                 if val is None:
  35.   241                     # If NULL is an allowed value, return it.
  36.   242                     if self.field.null:
  37.   243                         return None
  38.   244 ==>                 raise self.document.DoesNotExist()
  39.   245                 if not self.dereference:
  40.   246                     self.set_dereference()
  41.   247                 rel_obj = self.dereference(val)
  42.   248                 setattr(instance, self.cache_name, rel_obj)
  43.   249                 return rel_obj
  44.   250    
  45. Variables:
  46.                 self =
  47. <noc.core.model.fields.DocumentReferenceDescriptor object at 0x7fa34fd1bd90>
  48.             instance = <Prefix: default(): 10.248.32.4/30>
  49.        instance_type = <class 'noc.ip.models.prefix.Prefix'>
  50.                  val = None
  51. ------------------------------------------------------------------------
  52. File: lib/python3.8/site-packages/django/db/models/base.py (Line: 1238)
  53. Function: clean_fields
  54.  1231    
  55.  1232             errors = {}
  56.  1233             for f in self._meta.fields:
  57.  1234                 if f.name in exclude:
  58.  1235                     continue
  59.  1236                 # Skip validation for empty fields with blank=True. The developer
  60.  1237                 # is responsible for making sure they have a valid value.
  61.  1238 ==>             raw_value = getattr(self, f.attname)
  62.  1239                 if f.blank and raw_value in f.empty_values:
  63.  1240                     continue
  64.  1241                 try:
  65.  1242                     setattr(self, f.attname, f.clean(raw_value, self))
  66.  1243                 except ValidationError as e:
  67.  1244                     errors[f.name] = e.error_list
  68. Variables:
  69.                 self = <Prefix: default(): 10.248.32.4/30>
  70.              exclude = ['id', 'bi_id']
  71.               errors = {'afi': [ValidationError(['Это поле не может быть пустым.'])]}
  72.                    f = <noc.core.model.fields.DocumentReferenceField: profile>
  73.            raw_value = None
  74. ------------------------------------------------------------------------
  75. File: lib/python3.8/site-packages/django/db/models/base.py (Line: 1200)
  76. Function: full_clean
  77.  1193             errors = {}
  78.  1194             if exclude is None:
  79.  1195                 exclude = []
  80.  1196             else:
  81.  1197                 exclude = list(exclude)
  82.  1198    
  83.  1199             try:
  84.  1200 ==>             self.clean_fields(exclude=exclude)
  85.  1201             except ValidationError as e:
  86.  1202                 errors = e.update_error_dict(errors)
  87.  1203    
  88.  1204             # Form.clean() is run even if other validation fails, so do the
  89.  1205             # same with Model.clean() for consistency.
  90.  1206             try:
  91. Variables:
  92.                 self = <Prefix: default(): 10.248.32.4/30>
  93.              exclude = ['id', 'bi_id']
  94.      validate_unique = True
  95.               errors = {}
  96. ------------------------------------------------------------------------
  97. File: lib/app/extmodelapplication.py (Line: 587)
  98. Function: api_create
  99.   580                 return self.render_json(
  100.   581                     {"status": False, "message": "Duplicated record"}, status=self.CONFLICT
  101.   582                 )
  102.   583             except self.model.DoesNotExist:
  103.   584                 o = self.model(**attrs)
  104.   585                 # Run models validators
  105.   586                 try:
  106.   587 ==>                 o.full_clean(exclude=list(self.ignored_fields))
  107.   588                 except ValidationError as e:
  108.   589                     e_msg = []
  109.   590                     for f in e.message_dict:
  110.   591                         e_msg += ["%s: %s" % (f, "; ".join(e.message_dict[f]))]
  111.   592                     return self.render_json(
  112.   593                         {"status": False, "message": "Validation error: %s" % " | ".join(e_msg)},
  113. Variables:
  114.                 self =
  115. <noc.services.web.apps.ip.prefix.views.PrefixApplication object at 0x7fa34d8ca550>
  116.              request = <WSGIRequest: POST '/ip/prefix/'>
  117.            m2m_attrs = {}
  118.           file_attrs = {}
  119.               qattrs = {'prefix': '10.248.32.4/30'}
  120.                    o = <Prefix: default(): 10.248.32.4/30>
  121.                attrs = {'prefix': '10.248.32.4/30'}
  122. ------------------------------------------------------------------------
  123. File: lib/app/site.py (Line: 197)
  124. Function: inner
  125.   190                                 a = ujson.loads(request.body)
  126.   191                             else:
  127.   192                                 a = {k: v[0] if len(v) == 1 else v for k, v in request.POST.lists()}
  128.   193                         elif request.method == "GET":
  129.   194                             a = {k: v[0] if len(v) == 1 else v for k, v in request.GET.lists()}
  130.   195                         app_logger.debug("API %s %s %s", request.method, request.path, a)
  131.   196                     # Call handler
  132.   197 ==>                 r = v(request, *args, **kwargs)
  133.   198                     # Dump SQL statements
  134.   199                     if self.log_sql_statements:
  135.   200                         from django.db import connections
  136.   201    
  137.   202                         tsc = 0
  138.   203                         sc = defaultdict(int)
  139. Variables:
  140.              request = <WSGIRequest: POST '/ip/prefix/'>
  141.                 args = ()
  142.               kwargs = {}
  143.                    v =
  144. <bound method ExtModelApplication.api_create of <noc.services.web.apps.ip.prefix.views.PrefixApplication object at 0x7fa34d8ca550>>
  145.      to_log_api_call = False
  146.           app_logger = <Logger ip.prefix (INFO)>
  147.                   nq = <function Site.site_view.<locals>.inner.<locals>.nq at 0x7fa34aadcc10>
  148.        DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
  149.   InterfaceTypeError = <class 'ValueError'>
  150.     PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
  151.                  app =
  152. <noc.services.web.apps.ip.prefix.views.PrefixApplication object at 0x7fa34d8ca550>
  153.                 self = <noc.lib.app.site.Site object at 0x7fa364bc69a0>
  154.             view_map =
  155. {'GET': <bound method ExtModelApplication.api_list of <noc.services.web.apps.ip.prefix.views.PrefixApplication object at 0x7fa34d8ca550>>,
  156.  'POST': <bound method ExtModelApplication.api_create of <noc.services.web.apps.ip.prefix.views.PrefixApplication object at 0x7fa34d8ca550>>}
  157. ------------------------------------------------------------------------
  158. END OF TRACEBACK
  159.  
RAW Paste Data