Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UNHANDLED EXCEPTION (2021-07-21 10:27:39.531212)
- PROCESS: ./services/web/service.py
- VERSION: stable+release-20.4.2.d5e03df7
- BRANCH: release-20.4 CHANGESET: d5e03df7
- ERROR FINGERPRINT: bee30c8b-95a2-54ef-8c98-08dca3c128a0
- WORKING DIRECTORY: /opt/noc
- EXCEPTION: <class 'PermissionError'> [Errno 13] Permission denied: 'collections/cm.confdbqueries'
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: ../python3.8/lib/python3.8/os.py (Line: 223)
- Function: makedirs
- 216 pass
- 217 cdir = curdir
- 218 if isinstance(tail, bytes):
- 219 cdir = bytes(curdir, 'ASCII')
- 220 if tail == cdir: # xxx/newdir/. exists if xxx/newdir exists
- 221 return
- 222 try:
- 223 ==> mkdir(name, mode)
- 224 except OSError:
- 225 # Cannot rely on checking for EEXIST, since the operating system
- 226 # could give priority to other errors like EACCES or EROFS
- 227 if not exist_ok or not path.isdir(name):
- 228 raise
- 229
- Variables:
- name = 'collections/cm.confdbqueries'
- mode = 511
- exist_ok = False
- head = 'collections'
- tail = 'cm.confdbqueries'
- ------------------------------------------------------------------------
- File: core/fileutils.py (Line: 27)
- Function: safe_rewrite
- 20 def safe_rewrite(path, text, mode=None):
- 21 """
- 22 Create new file filled with "text" safely
- 23 """
- 24 text = smart_text(text)
- 25 d = os.path.dirname(path)
- 26 if d and not os.path.exists(d):
- 27 ==> os.makedirs(d)
- 28 b = os.path.basename(path)
- 29 h, p = tempfile.mkstemp(suffix=".tmp", prefix=b, dir=d)
- 30 f = os.fdopen(h, "w")
- 31 f.write(text)
- 32 f.flush()
- 33 f.close()
- Variables:
- path = 'collections/cm.confdbqueries/hostname.json'
- text =
- ('{\n'
- ' "name": "hostname",\n'
- ' "$collection": "cm.confdbqueries",\n'
- ' "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
- ' "source": "Match(\'system\', \'hostname\', hostname,)",\n'
- ' "params": [\n'
- ' {\n'
- ' "default": null,\n'
- ' "description": null,\n'
- ' "name": "hostname",\n'
- ' "type": "str"\n'
- ' }\n'
- ' ],\n'
- ' "allow_object_filter": false,\n'
- ' "allow_interface_filter": false,\n'
- ' "allow_object_validation": true,\n'
- ' "allow_interface_validation": false,\n'
- ' "allow_object_classification": false,\n'
- ' "allow_interface_classification": false,\n'
- ' "require_raw": false\n'
- '}\n')
- mode = 420
- d = 'collections/cm.confdbqueries'
- ------------------------------------------------------------------------
- File: core/collection/base.py (Line: 412)
- Function: install
- 405 # Format JSON
- 406 json_data = o.to_json()
- 407 # Write
- 408 path = os.path.join(cls.PREFIX, c.name, o.get_json_path())
- 409 if "uuid" not in data:
- 410 raise ValueError("Invalid JSON: No UUID")
- 411 c.stdout.write("[%s|%s] Installing %s\n" % (c.name, data["uuid"], path))
- 412 ==> safe_rewrite(path, json_data, mode=0o644)
- Variables:
- cls = <class 'noc.core.collection.base.Collection'>
- data =
- {'allow_interface_classification': False,
- 'allow_interface_filter': False,
- 'allow_interface_validation': False,
- 'allow_object_classification': False,
- 'allow_object_filter': False,
- 'allow_object_validation': True,
- 'name': 'hostname',
- 'params': [<ConfDBQueryParam: hostname>],
- 'require_raw': False,
- 'source': "Match('system', 'hostname', hostname,)",
- 'uuid': UUID('72ae0be2-30af-40ef-b8f6-b23686cb8b02')}
- c = <noc.core.collection.base.Collection object at 0x7ff27f0f15e0>
- o = <ConfDBQuery: hostname>
- json_data =
- ('{\n'
- ' "name": "hostname",\n'
- ' "$collection": "cm.confdbqueries",\n'
- ' "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
- ' "source": "Match(\'system\', \'hostname\', hostname,)",\n'
- ' "params": [\n'
- ' {\n'
- ' "default": null,\n'
- ' "description": null,\n'
- ' "name": "hostname",\n'
- ' "type": "str"\n'
- ' }\n'
- ' ],\n'
- ' "allow_object_filter": false,\n'
- ' "allow_interface_filter": false,\n'
- ' "allow_object_validation": true,\n'
- ' "allow_interface_validation": false,\n'
- ' "allow_object_classification": false,\n'
- ' "allow_interface_classification": false,\n'
- ' "require_raw": false\n'
- '}\n')
- path = 'collections/cm.confdbqueries/hostname.json'
- ------------------------------------------------------------------------
- File: services/web/apps/main/jsonimport/views.py (Line: 45)
- Function: api_import
- 38 try:
- 39 if isinstance(jdata, list):
- 40 for d in jdata:
- 41 Collection.install(d)
- 42 c = Collection(d["$collection"])
- 43 c.update_item(d)
- 44 else:
- 45 ==> Collection.install(jdata)
- 46 c = Collection(jdata["$collection"])
- 47 c.update_item(jdata)
- 48 except ValueError as e:
- 49 return {"status": False, "error": str(e)}
- 50 return {"status": True}
- Variables:
- self =
- <noc.services.web.apps.main.jsonimport.views.JSONImportApplication object at 0x7ff281e77d90>
- request = <WSGIRequest: POST '/main/jsonimport/'>
- json =
- ('{\n'
- ' "name": "hostname",\n'
- ' "$collection": "cm.confdbqueries",\n'
- ' "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
- ' "source": "Match(\'system\', \'hostname\', hostname,)",\n'
- ' "params": [\n'
- ' {\n'
- ' "default": null,\n'
- ' "description": null,\n'
- ' "name": "hostname",\n'
- ' "type": "str"\n'
- ' }\n'
- ' ],\n'
- ' "allow_object_filter": false,\n'
- ' "allow_interface_filter": false,\n'
- ' "allow_object_validation": true,\n'
- ' "allow_interface_validation": false,\n'
- ' "allow_object_classification": false,\n'
- ' "allow_interface_classification": false,\n'
- ' "require_raw": false\n'
- '}\n')
- jdata =
- {'$collection': 'cm.confdbqueries',
- 'allow_interface_classification': False,
- 'allow_interface_filter': False,
- 'allow_interface_validation': False,
- 'allow_object_classification': False,
- 'allow_object_filter': False,
- 'allow_object_validation': True,
- 'name': 'hostname',
- 'params': [{'default': None,
- 'description': None,
- 'name': 'hostname',
- 'type': 'str'}],
- 'require_raw': False,
- 'source': "Match('system', 'hostname', hostname,)",
- 'uuid': '72ae0be2-30af-40ef-b8f6-b23686cb8b02'}
- ------------------------------------------------------------------------
- File: lib/app/site.py (Line: 198)
- Function: inner
- 191 a = orjson.loads(request.body)
- 192 else:
- 193 a = {k: v[0] if len(v) == 1 else v for k, v in request.POST.lists()}
- 194 elif request.method == "GET":
- 195 a = {k: v[0] if len(v) == 1 else v for k, v in request.GET.lists()}
- 196 app_logger.debug("API %s %s %s", request.method, request.path, a)
- 197 # Call handler
- 198 ==> r = v(request, *args, **kwargs)
- 199 # Dump SQL statements
- 200 if self.log_sql_statements:
- 201 from django.db import connections
- 202
- 203 tsc = 0
- 204 sc = defaultdict(int)
- Variables:
- request = <WSGIRequest: POST '/main/jsonimport/'>
- args = ()
- kwargs =
- {'json': '{\n'
- ' "name": "hostname",\n'
- ' "$collection": "cm.confdbqueries",\n'
- ' "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
- ' "source": "Match(\'system\', \'hostname\', hostname,)",\n'
- ' "params": [\n'
- ' {\n'
- ' "default": null,\n'
- ' "description": null,\n'
- ' "name": "hostname",\n'
- ' "type": "str"\n'
- ' }\n'
- ' ],\n'
- ' "allow_object_filter": false,\n'
- ' "allow_interface_filter": false,\n'
- ' "allow_object_validation": true,\n'
- ' "allow_interface_validation": false,\n'
- ' "allow_object_classification": false,\n'
- ' "allow_interface_classification": false,\n'
- ' "require_raw": false\n'
- '}\n'}
- v =
- <bound method JSONImportApplication.api_import of <noc.services.web.apps.main.jsonimport.views.JSONImportApplication object at 0x7ff281e77d90>>
- to_log_api_call = False
- app_logger = <Logger main.jsonimport (INFO)>
- errors = None
- g =
- {'json': '{\n'
- ' "name": "hostname",\n'
- ' "$collection": "cm.confdbqueries",\n'
- ' "uuid": "72ae0be2-30af-40ef-b8f6-b23686cb8b02",\n'
- ' "source": "Match(\'system\', \'hostname\', hostname,)",\n'
- ' "params": [\n'
- ' {\n'
- ' "default": null,\n'
- ' "description": null,\n'
- ' "name": "hostname",\n'
- ' "type": "str"\n'
- ' }\n'
- ' ],\n'
- ' "allow_object_filter": false,\n'
- ' "allow_interface_filter": false,\n'
- ' "allow_object_validation": true,\n'
- ' "allow_interface_validation": false,\n'
- ' "allow_object_classification": false,\n'
- ' "allow_interface_classification": false,\n'
- ' "require_raw": false\n'
- '}\n'}
- nq = <function Site.site_view.<locals>.inner.<locals>.nq at 0x7ff27e39f4c0>
- DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
- InterfaceTypeError = <class 'ValueError'>
- PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
- app =
- <noc.services.web.apps.main.jsonimport.views.JSONImportApplication object at 0x7ff281e77d90>
- self = <noc.lib.app.site.Site object at 0x7ff2a27ce460>
- view_map =
- {'POST': <bound method JSONImportApplication.api_import of <noc.services.web.apps.main.jsonimport.views.JSONImportApplication object at 0x7ff281e77d90>>}
- ------------------------------------------------------------------------
- END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement