Advertisement
Izya12

crashinfo bee30c8b-95a2-54ef-8c98-08dca3c128a0

Jul 21st, 2021
2,173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 11.00 KB | None | 0 0
  1. UNHANDLED EXCEPTION (2021-07-21 10:27:39.531212)
  2. PROCESS: ./services/web/service.py
  3. VERSION: stable+release-20.4.2.d5e03df7
  4. BRANCH: release-20.4 CHANGESET: d5e03df7
  5. ERROR FINGERPRINT: bee30c8b-95a2-54ef-8c98-08dca3c128a0
  6. WORKING DIRECTORY: /opt/noc
  7. EXCEPTION: <class 'PermissionError'> [Errno 13] Permission denied: 'collections/cm.confdbqueries'
  8. START OF TRACEBACK
  9. ------------------------------------------------------------------------
  10. File: ../python3.8/lib/python3.8/os.py (Line: 223)
  11. Function: makedirs
  12.   216                 pass
  13.   217             cdir = curdir
  14.   218             if isinstance(tail, bytes):
  15.   219                 cdir = bytes(curdir, 'ASCII')
  16.   220             if tail == cdir:           # xxx/newdir/. exists if xxx/newdir exists
  17.   221                 return
  18.   222         try:
  19.   223 ==>         mkdir(name, mode)
  20.   224         except OSError:
  21.   225             # Cannot rely on checking for EEXIST, since the operating system
  22.   226             # could give priority to other errors like EACCES or EROFS
  23.   227             if not exist_ok or not path.isdir(name):
  24.   228                 raise
  25.   229
  26. Variables:
  27.                 name = 'collections/cm.confdbqueries'
  28.                 mode = 511
  29.             exist_ok = False
  30.                 head = 'collections'
  31.                 tail = 'cm.confdbqueries'
  32. ------------------------------------------------------------------------
  33. File: core/fileutils.py (Line: 27)
  34. Function: safe_rewrite
  35.    20     def safe_rewrite(path, text, mode=None):
  36.    21         """
  37.   22         Create new file filled with "text" safely
  38.   23         """
  39.    24         text = smart_text(text)
  40.    25         d = os.path.dirname(path)
  41.    26         if d and not os.path.exists(d):
  42.    27 ==>         os.makedirs(d)
  43.    28         b = os.path.basename(path)
  44.    29         h, p = tempfile.mkstemp(suffix=".tmp", prefix=b, dir=d)
  45.    30         f = os.fdopen(h, "w")
  46.    31         f.write(text)
  47.    32         f.flush()
  48.    33         f.close()
  49. Variables:
  50.                 path = 'collections/cm.confdbqueries/hostname.json'
  51.                 text =
  52. ('{\n'
  53.  '    "name": "hostname",\n'
  54.  '    "$collection": "cm.confdbqueries",\n'
  55.  '    "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
  56.  '    "source": "Match(\'system\',  \'hostname\', hostname,)",\n'
  57.  '    "params": [\n'
  58.  '        {\n'
  59.  '            "default": null,\n'
  60.  '            "description": null,\n'
  61.  '            "name": "hostname",\n'
  62.  '            "type": "str"\n'
  63.  '        }\n'
  64.  '    ],\n'
  65.  '    "allow_object_filter": false,\n'
  66.  '    "allow_interface_filter": false,\n'
  67.  '    "allow_object_validation": true,\n'
  68.  '    "allow_interface_validation": false,\n'
  69.  '    "allow_object_classification": false,\n'
  70.  '    "allow_interface_classification": false,\n'
  71.  '    "require_raw": false\n'
  72.  '}\n')
  73.                 mode = 420
  74.                    d = 'collections/cm.confdbqueries'
  75. ------------------------------------------------------------------------
  76. File: core/collection/base.py (Line: 412)
  77. Function: install
  78.   405             # Format JSON
  79.   406             json_data = o.to_json()
  80.   407             # Write
  81.   408             path = os.path.join(cls.PREFIX, c.name, o.get_json_path())
  82.   409             if "uuid" not in data:
  83.   410                 raise ValueError("Invalid JSON: No UUID")
  84.   411             c.stdout.write("[%s|%s] Installing %s\n" % (c.name, data["uuid"], path))
  85.   412 ==>         safe_rewrite(path, json_data, mode=0o644)
  86.  
  87. Variables:
  88.                  cls = <class 'noc.core.collection.base.Collection'>
  89.                 data =
  90. {'allow_interface_classification': False,
  91.  'allow_interface_filter': False,
  92.  'allow_interface_validation': False,
  93.  'allow_object_classification': False,
  94.  'allow_object_filter': False,
  95.  'allow_object_validation': True,
  96.  'name': 'hostname',
  97.  'params': [<ConfDBQueryParam: hostname>],
  98.  'require_raw': False,
  99.  'source': "Match('system',  'hostname', hostname,)",
  100.  'uuid': UUID('72ae0be2-30af-40ef-b8f6-b23686cb8b02')}
  101.                    c = <noc.core.collection.base.Collection object at 0x7ff27f0f15e0>
  102.                    o = <ConfDBQuery: hostname>
  103.            json_data =
  104. ('{\n'
  105.  '    "name": "hostname",\n'
  106.  '    "$collection": "cm.confdbqueries",\n'
  107.  '    "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
  108.  '    "source": "Match(\'system\',  \'hostname\', hostname,)",\n'
  109.  '    "params": [\n'
  110.  '        {\n'
  111.  '            "default": null,\n'
  112.  '            "description": null,\n'
  113.  '            "name": "hostname",\n'
  114.  '            "type": "str"\n'
  115.  '        }\n'
  116.  '    ],\n'
  117.  '    "allow_object_filter": false,\n'
  118.  '    "allow_interface_filter": false,\n'
  119.  '    "allow_object_validation": true,\n'
  120.  '    "allow_interface_validation": false,\n'
  121.  '    "allow_object_classification": false,\n'
  122.  '    "allow_interface_classification": false,\n'
  123.  '    "require_raw": false\n'
  124.  '}\n')
  125.                 path = 'collections/cm.confdbqueries/hostname.json'
  126. ------------------------------------------------------------------------
  127. File: services/web/apps/main/jsonimport/views.py (Line: 45)
  128. Function: api_import
  129.    38             try:
  130.    39                 if isinstance(jdata, list):
  131.    40                     for d in jdata:
  132.    41                         Collection.install(d)
  133.    42                         c = Collection(d["$collection"])
  134.    43                         c.update_item(d)
  135.    44                 else:
  136.    45 ==>                 Collection.install(jdata)
  137.    46                     c = Collection(jdata["$collection"])
  138.    47                     c.update_item(jdata)
  139.    48             except ValueError as e:
  140.    49                 return {"status": False, "error": str(e)}
  141.    50             return {"status": True}
  142. Variables:
  143.                 self =
  144. <noc.services.web.apps.main.jsonimport.views.JSONImportApplication object at 0x7ff281e77d90>
  145.              request = <WSGIRequest: POST '/main/jsonimport/'>
  146.                 json =
  147. ('{\n'
  148.  '    "name": "hostname",\n'
  149.  '    "$collection": "cm.confdbqueries",\n'
  150.  '    "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
  151.  '    "source": "Match(\'system\',  \'hostname\', hostname,)",\n'
  152.  '    "params": [\n'
  153.  '        {\n'
  154.  '            "default": null,\n'
  155.  '            "description": null,\n'
  156.  '            "name": "hostname",\n'
  157.  '            "type": "str"\n'
  158.  '        }\n'
  159.  '    ],\n'
  160.  '    "allow_object_filter": false,\n'
  161.  '    "allow_interface_filter": false,\n'
  162.  '    "allow_object_validation": true,\n'
  163.  '    "allow_interface_validation": false,\n'
  164.  '    "allow_object_classification": false,\n'
  165.  '    "allow_interface_classification": false,\n'
  166.  '    "require_raw": false\n'
  167.  '}\n')
  168.                jdata =
  169. {'$collection': 'cm.confdbqueries',
  170.  'allow_interface_classification': False,
  171.  'allow_interface_filter': False,
  172.  'allow_interface_validation': False,
  173.  'allow_object_classification': False,
  174.  'allow_object_filter': False,
  175.  'allow_object_validation': True,
  176.  'name': 'hostname',
  177.  'params': [{'default': None,
  178.              'description': None,
  179.              'name': 'hostname',
  180.              'type': 'str'}],
  181.  'require_raw': False,
  182.  'source': "Match('system',  'hostname', hostname,)",
  183.  'uuid': '72ae0be2-30af-40ef-b8f6-b23686cb8b02'}
  184. ------------------------------------------------------------------------
  185. File: lib/app/site.py (Line: 198)
  186. Function: inner
  187.   191                                 a = orjson.loads(request.body)
  188.   192                             else:
  189.   193                                 a = {k: v[0] if len(v) == 1 else v for k, v in request.POST.lists()}
  190.   194                         elif request.method == "GET":
  191.   195                             a = {k: v[0] if len(v) == 1 else v for k, v in request.GET.lists()}
  192.   196                         app_logger.debug("API %s %s %s", request.method, request.path, a)
  193.   197                     # Call handler
  194.   198 ==>                 r = v(request, *args, **kwargs)
  195.   199                     # Dump SQL statements
  196.   200                     if self.log_sql_statements:
  197.   201                         from django.db import connections
  198.   202
  199.   203                         tsc = 0
  200.   204                         sc = defaultdict(int)
  201. Variables:
  202.              request = <WSGIRequest: POST '/main/jsonimport/'>
  203.                 args = ()
  204.               kwargs =
  205. {'json': '{\n'
  206.          '    "name": "hostname",\n'
  207.          '    "$collection": "cm.confdbqueries",\n'
  208.          '    "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
  209.          '    "source": "Match(\'system\',  \'hostname\', hostname,)",\n'
  210.          '    "params": [\n'
  211.          '        {\n'
  212.          '            "default": null,\n'
  213.          '            "description": null,\n'
  214.          '            "name": "hostname",\n'
  215.          '            "type": "str"\n'
  216.          '        }\n'
  217.          '    ],\n'
  218.          '    "allow_object_filter": false,\n'
  219.          '    "allow_interface_filter": false,\n'
  220.          '    "allow_object_validation": true,\n'
  221.          '    "allow_interface_validation": false,\n'
  222.          '    "allow_object_classification": false,\n'
  223.          '    "allow_interface_classification": false,\n'
  224.          '    "require_raw": false\n'
  225.          '}\n'}
  226.                    v =
  227. <bound method JSONImportApplication.api_import of <noc.services.web.apps.main.jsonimport.views.JSONImportApplication object at 0x7ff281e77d90>>
  228.      to_log_api_call = False
  229.           app_logger = <Logger main.jsonimport (INFO)>
  230.               errors = None
  231.                    g =
  232. {'json': '{\n'
  233.          '    "name": "hostname",\n'
  234.          '    "$collection": "cm.confdbqueries",\n'
  235.          '    "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
  236.          '    "source": "Match(\'system\',  \'hostname\', hostname,)",\n'
  237.          '    "params": [\n'
  238.          '        {\n'
  239.          '            "default": null,\n'
  240.          '            "description": null,\n'
  241.          '            "name": "hostname",\n'
  242.          '            "type": "str"\n'
  243.          '        }\n'
  244.          '    ],\n'
  245.          '    "allow_object_filter": false,\n'
  246.          '    "allow_interface_filter": false,\n'
  247.          '    "allow_object_validation": true,\n'
  248.          '    "allow_interface_validation": false,\n'
  249.          '    "allow_object_classification": false,\n'
  250.          '    "allow_interface_classification": false,\n'
  251.          '    "require_raw": false\n'
  252.          '}\n'}
  253.                   nq = <function Site.site_view.<locals>.inner.<locals>.nq at 0x7ff27e39f4c0>
  254.        DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
  255.   InterfaceTypeError = <class 'ValueError'>
  256.     PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
  257.                  app =
  258. <noc.services.web.apps.main.jsonimport.views.JSONImportApplication object at 0x7ff281e77d90>
  259.                 self = <noc.lib.app.site.Site object at 0x7ff2a27ce460>
  260.             view_map =
  261. {'POST': <bound method JSONImportApplication.api_import of <noc.services.web.apps.main.jsonimport.views.JSONImportApplication object at 0x7ff281e77d90>>}
  262. ------------------------------------------------------------------------
  263. END OF TRACEBACK
  264.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement