Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • N noc
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 454
    • Issues 454
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 25
    • Merge requests 25
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • External wiki
    • External wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • noc
  • noc
  • Issues
  • #1047
Closed
Open
Issue created May 14, 2019 by Alexey Shapovalov@lexusContributor

IPAM: Error when deleting prefix recursively

Steps to reproduce

Ошибка возникает при рекурсивном удалении (Delete prefix and all nested prefixes, addresses and permissions) префикса, в котором содержатся адреса. Модулем DNS не пользуюсь, зон нет.

Relevant logs and/or screenshots

2019-05-14 17:07:17,619 [ip.prefix] UNHANDLED EXCEPTION (2019-05-14 17:07:17.607312)
PROCESS: ./services/web/service.py
VERSION: 19.1+master.208.c362abe9
BRANCH: master CHANGESET: c362abe9
ERROR FINGERPRINT: dd401b59-842a-581a-8ec7-14de77992c20
WORKING DIRECTORY: /opt/noc
EXCEPTION: <type 'exceptions.AttributeError'> type object 'DNSZone' has no attribute 'touch'
START OF TRACEBACK
------------------------------------------------------------------------
File: ip/models/prefix.py (Line: 339)
Function: delete_recursive
  332                 afi=self.afi
  333             ).extra(
  334                 where=["prefix <<= %s"],
  335                 params=[self.prefix]
  336             )
  337             # Touch dns zones
  338             for z in zones:
  339 ==>             DNSZone.touch(z)
  340
  341         @property
  342         def maintainers(self):
  343             """
  344             List of persons having write access
  345             @todo: PostgreSQL-independent implementation
Variables:
                   a = <Address: VRF2_10.126.16.21:19(4): 10.87.86.6>
               zones =
set(['10.87.86.5',
     '10.87.86.6',
     u'host-10-87-86-5.mydomain.ru',
     u'host-10-87-86-6.mydomain.ru'])
                self = <Prefix: VRF2_10.126.16.21:19(4): 10.87.86.4/30>
                   z = u'host-10-87-86-5.mydomain.ru'
                 ids = []
------------------------------------------------------------------------
File: services/web/apps/ip/prefix/views.py (Line: 114)
Function: api_delete_recursive
  107             # Check permissions
  108             if not self.can_delete(request.user, o):
  109                 return self.render_json({
  110                     "status": False,
  111                     "message": "Permission denied"
  112                 }, status=self.FORBIDDEN)
  113             try:
  114 ==>             o.delete_recursive()
  115             except ValueError as e:
  116                 return self.render_json(
  117                     {
  118                         "success": False,
  119                         "message": "ERROR: %s" % e
  120                     }, status=self.CONFLICT)
Variables:
                self =
<noc.services.web.apps.ip.prefix.views.PrefixApplication object at 0x7f0910a458d0>
             request =
<WSGIRequest
path:/ip/prefix/4623/recursive/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
META:{'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br',
 'HTTP_ACCEPT_LANGUAGE': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
 'HTTP_CONNECTION': 'close',
 'HTTP_HOST': 'noc01.mydomain.ru',
 'HTTP_REFERER': 'https://noc01.mydomain.ru/',
 'HTTP_REMOTE_USER': 'user1',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0',
 'HTTP_X_FORWARDED_FOR': '10.178.14.70',
 'HTTP_X_FORWARDED_PROTO': 'https',
 'HTTP_X_REAL_IP': '10.178.14.70',
 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
 'HTTP_X_SCHEME': 'https',
 'PATH_INFO': u'/ip/prefix/4623/recursive/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '10.178.14.70',
 'REQUEST_METHOD': 'DELETE',
 'SCRIPT_NAME': u'',
 'SERVER_NAME': 'noc01.mydomain.ru',
 'SERVER_PORT': '443',
 'SERVER_PROTOCOL': 'HTTP/1.0',
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f093042d1e0>,
 'wsgi.input': <_io.BytesIO object at 0x7f090e5ad6b0>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'https',
 'wsgi.version': (1, 0)}>
                  id = u'4623'
                   o = <Prefix: VRF2_10.126.16.21:19(4): 10.87.86.4/30>
------------------------------------------------------------------------
File: lib/app/site.py (Line: 229)
Function: inner
  222                                          for k, v in request.POST.lists())
  223                         elif request.method == "GET":
  224                             a = dict((k, v[0] if len(v) == 1 else v)
  225                                      for k, v in request.GET.lists())
  226                         app_logger.debug("API %s %s %s",
  227                                          request.method, request.path, a)
  228                     # Call handler
  229 ==>                 r = v(request, *args, **kwargs)
  230                     # Dump SQL statements
  231                     if self.log_sql_statements:
  232                         from django.db import connections
  233                         tsc = 0
  234                         sc = defaultdict(int)
  235                         for conn in connections.all():
Variables:
                args = ()
            view_map =
{'DELETE': <bound method PrefixApplication.api_delete_recursive of <noc.services.web.apps.ip.prefix.views.PrefixApplication object at 0x7f0910a458d0>>}
    PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
       DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
                self = <noc.lib.app.site.Site object at 0x7f09153e2790>
                   v =
<bound method PrefixApplication.api_delete_recursive of <noc.services.web.apps.ip.prefix.views.PrefixApplication object at 0x7f0910a458d0>>
             request =
<WSGIRequest
path:/ip/prefix/4623/recursive/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
META:{'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br',
 'HTTP_ACCEPT_LANGUAGE': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
 'HTTP_CONNECTION': 'close',
 'HTTP_HOST': 'noc01.mydomain.ru',
 'HTTP_REFERER': 'https://noc01.mydomain.ru/',
 'HTTP_REMOTE_USER': 'user1',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0',
 'HTTP_X_FORWARDED_FOR': '10.178.14.70',
 'HTTP_X_FORWARDED_PROTO': 'https',
 'HTTP_X_REAL_IP': '10.178.14.70',
 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
 'HTTP_X_SCHEME': 'https',
 'PATH_INFO': u'/ip/prefix/4623/recursive/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '10.178.14.70',
 'REQUEST_METHOD': 'DELETE',
 'SCRIPT_NAME': u'',
 'SERVER_NAME': 'noc01.mydomain.ru',
 'SERVER_PORT': '443',
 'SERVER_PROTOCOL': 'HTTP/1.0',
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f093042d1e0>,
 'wsgi.input': <_io.BytesIO object at 0x7f090e5ad6b0>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'https',
 'wsgi.version': (1, 0)}>
          app_logger = <logging.Logger object at 0x7f0910a45710>
  InterfaceTypeError = <type 'exceptions.ValueError'>
     to_log_api_call = False
              kwargs = {'id': u'4623'}
                  nq = <function nq at 0x7f091088ab18>
                 app =
<noc.services.web.apps.ip.prefix.views.PrefixApplication object at 0x7f0910a458d0>
------------------------------------------------------------------------
END OF TRACEBACK

Possible fixes

Временно решил комментированием строчек:

# for z in zones:
#     DNSZone.touch(z)

в ip/models/prefix.py

Paste NOC version (./noc about)

NOC version is: 19.1+master.208.c362abe9

Edited Jun 25, 2019 by Alexey Shapovalov
Assignee
Assign to
Time tracking