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 445
    • Issues 445
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 30
    • Merge requests 30
  • 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
  • #1760
Closed
Open
Issue created Dec 30, 2021 by DarkL@DarkLContributor

cannot import name 'FirmwarePolicy' при ./noc sync-perm

Crashinfo

При обновлении на 20.4+master.2241.4ad02aa5

Crashinfo

TASK [migrate : Synchronize permissions] 08:07fatal: [noc]: FAILED! => {
    "changed": true,
    "cmd": [
        "./noc",
        "sync-perm"
    ],
    "delta": "0:00:02.294665",
    "end": "2021-12-30 15:14:24.874981",
    "rc": 2,
    "start": "2021-12-30 15:14:22.580316"
}

STDOUT:

2021-12-30 15:14:22,916 [noc.core.ioloop.util] Setting up asyncio event loop policy
2021-12-30 15:14:22,916 [noc.core.ioloop.util] Setting up default event loop
2021-12-30 15:14:23,001 [noc.core.dcs.base] Resolve near service postgres
2021-12-30 15:14:23,007 [noc.core.dcs.base] Resolved near service postgres to ['192.168.0.1:5432']
2021-12-30 15:14:23,171 [noc.core.dcs.base] [mongo] Starting resolver (near=False)
2021-12-30 15:14:23,174 [noc.core.dcs.base] [mongo] Set active services to: mongo: 192.168.0.1:27017
2021-12-30 15:14:23,174 [noc.core.dcs.base] [mongo] Stopping resolver
2021-12-30 15:14:23,175 [noc.core.mongo.connection] Connecting to MongoDB {'db': 'noc', 'username': 'noc', 'password': '********', 'authentication_source': 'noc', 'replicaSet': 'noc', 'readPreference': 'secondaryPreferred', 'maxIdleTimeMS': 60000, 'host': 'mongodb://noc:********@192.168.0.1:27017/noc'}
2021-12-30 15:14:23,274 [stub] Activating stub service
2021-12-30 15:14:23,274 [stub] Starting IOLoop
2021-12-30 15:14:23,415 [noc.core.cache.base] Using cache backend: noc.core.cache.mongo.MongoCache
2021-12-30 15:14:23,499 [root] Loading DownloaderRegistry
2021-12-30 15:14:23,812 [root] Loading CalculatorRegistry
2021-12-30 15:14:24,317 [noc.core.debug] UNHANDLED EXCEPTION (2021-12-30 15:14:24.035351)
PROCESS: ./commands/sync-perm.py
VERSION: 20.4+master.2241.4ad02aa5
BRANCH: master CHANGESET: 4ad02aa5
ERROR FINGERPRINT: 29edebb0-a390-57eb-99d3-fd22eb894d39
WORKING DIRECTORY: /opt/noc
EXCEPTION:  cannot import name 'FirmwarePolicy' from partially initialized module 'noc.inv.models.firmwarepolicy' (most likely due to a circular import) (/opt/noc/inv/models/firmwarepolicy.py)
START OF TRACEBACK
------------------------------------------------------------------------
File: inv/models/firmware.py (Line: 195)
Function: 
  188             r = {}
  189             for fwp in FirmwarePolicy.get_effective_policies(self):
  190                 if fwp.object_settings:
  191                     r.update(fwp.object_settings)
  192             return r
  193     
  194     
  195 ==> from .firmwarepolicy import FirmwarePolicy

Variables:
            __name__ = 'noc.inv.models.firmware'
             __doc__ = None
         __package__ = 'noc.inv.models'
          __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x7f313c83d160>
            __spec__ = 
ModuleSpec(name='noc.inv.models.firmware', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f313c83d160>, origin='/opt/noc/inv/models/firmware.py')
            __file__ = '/opt/noc/inv/models/firmware.py'
          __cached__ = '/opt/noc/inv/models/__pycache__/firmware.cpython-38.pyc'
        __builtins__ = 
{'ArithmeticError': ,
 'AssertionError': ,
 'AttributeError': ,
 'BaseException': ,
 'BlockingIOError': ,
 'BrokenPipeError': ,
 'BufferError': ,
 'BytesWarning': ,
 'ChildProcessError': ,
 'ConnectionAbortedError': ,
 'ConnectionError': ,
 'ConnectionRefusedError': ,
 'ConnectionResetError': ,
 'DeprecationWarning': ,
 'EOFError': ,
 'Ellipsis': Ellipsis,
 'EnvironmentError': ,
 'Exception': ,
 'False': False,
 'FileExistsError': ,
 'FileNotFoundError': ,
 'FloatingPointError': ,
 'FutureWarning': ,
 'GeneratorExit': ,
 'IOError': ,
 'ImportError': ,
 'ImportWarning': ,
 'IndentationError': ,
 'IndexError': ,
 'InterruptedError': ,
 'IsADirectoryError': ,
 'KeyError': ,
 'KeyboardInterrupt': ,
 'LookupError': ,
 'MemoryError': ,
 'ModuleNotFoundError': ,
 'NameError': ,
 'None': None,
 'NotADirectoryError': ,
 'NotImplemented': NotImplemented,
 'NotImplementedError': ,
 'OSError': ,
 'OverflowError': ,
 'PendingDeprecationWarning': ,
 'PermissionError': ,
 'ProcessLookupError': ,
 'RecursionError': ,
 'ReferenceError': ,
 'ResourceWarning': ,
 'RuntimeError': ,
 'RuntimeWarning': ,
 'StopAsyncIteration': ,
 'StopIteration': ,
 'SyntaxError': ,
 'SyntaxWarning': ,
 'SystemError': ,
 'SystemExit': ,
 'TabError': ,
 'TimeoutError': ,
 'True': True,
 'TypeError': ,
 'UnboundLocalError': ,
 'UnicodeDecodeError': ,
 'UnicodeEncodeError': ,
 'UnicodeError': ,
 'UnicodeTranslateError': ,
 'UnicodeWarning': ,
 'UserWarning': ,
 'ValueError': ,
 'Warning': ,
 'ZeroDivisionError': ,
 '__build_class__': ,
 '__debug__': True,
 '__doc__': 'Built-in functions, exceptions, and other objects.\n'
            '\n'
            "Noteworthy: None is the `nil' object; Ellipsis represents `...' "
            'in slices.',
 '__import__': ,
 '__loader__': ,
 '__name__': 'builtins',
 '__package__': '',
 '__spec__': ModuleSpec(name='builtins', loader=),
 'abs': ,
 'all': ,
 'any': ,
 'ascii': ,
 'bin': ,
 'bool': ,
 'breakpoint': ,
 'bytearray': ,
 'bytes': ,
 'callable': ,
 'chr': ,
 'classmethod': ,
 'compile': ,
 'complex': ,
 'copyright': Copyright (c) 2001-2020 Python Software Foundation.
All Rights Reserved.

Copyright (c) 2000 BeOpen.com.
All Rights Reserved.

Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.

Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved.,
 'credits':     Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
    for supporting Python development.  See www.python.org for more information.,
 'delattr': ,
 'dict': ,
 'dir': ,
 'divmod': ,
 'enumerate': ,
 'eval': ,
 'exec': ,
 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit,
 'filter': ,
 'float': ,
 'format': ,
 'frozenset': ,
 'getattr': ,
 'globals': ,
 'hasattr': ,
 'hash': ,
 'help': Type help() for interactive help, or help(object) for help about object.,
 'hex': ,
 'id': ,
 'input': ,
 'int': ,
 'isinstance': ,
 'issubclass': ,
 'iter': ,
 'len': ,
 'license': Type license() to see the full license text,
 'list': ,
 'locals': ,
 'map': ,
 'max': ,
 'memoryview': ,
 'min': ,
 'next': ,
 'object': ,
 'oct': ,
 'open': ,
 'ord': ,
 'pow': ,
 'print': ,
 'property': ,
 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit,
 'range': ,
 'repr': ,
 'reversed': ,
 'round': ,
 'set': ,
 'setattr': ,
 'slice': ,
 'sorted': ,
 'staticmethod': ,
 'str': ,
 'sum': ,
 'super': ,
 'tuple': ,
 'type': ,
 'vars': ,
 'zip': }
                  os = 
           threading = 
            operator = 
                uuid = 
                Dict = typing.Dict
            Optional = typing.Optional
               Union = typing.Union
            Document = 
         StringField = 
           LongField = 
           UUIDField = 
      NotUniqueError = 
          cachetools = 

              Vendor = 
             Profile = 
 PlainReferenceField = 
             bi_sync = 
             to_json = 
>
     on_delete_check = 
              change = 
             id_lock = 
            Firmware = 
------------------------------------------------------------------------
File: inv/models/firmwarepolicy.py (Line: 24)
Function: 
   17     import cachetools
   18     
   19     # NOC modules
   20     from noc.core.mongo.fields import PlainReferenceField
   21     from noc.core.model.decorator import on_save, on_delete
   22     from noc.main.models.label import Label
   23     from noc.core.cache.base import cache
   24 ==> from .firmware import Firmware
   25     from .platform import Platform
   26     
   27     id_lock = Lock()
   28     
   29     FS_RECOMMENDED = "r"
   30     FS_ACCEPTABLE = "a"
Variables:
            __name__ = 'noc.inv.models.firmwarepolicy'
             __doc__ = None
         __package__ = 'noc.inv.models'
          __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x7f313c82bfd0>
            __spec__ = 
ModuleSpec(name='noc.inv.models.firmwarepolicy', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f313c82bfd0>, origin='/opt/noc/inv/models/firmwarepolicy.py')
            __file__ = '/opt/noc/inv/models/firmwarepolicy.py'
          __cached__ = '/opt/noc/inv/models/__pycache__/firmwarepolicy.cpython-38.pyc'
        __builtins__ = 
{'ArithmeticError': ,
 'AssertionError': ,
 'AttributeError': ,
 'BaseException': ,
 'BlockingIOError': ,
 'BrokenPipeError': ,
 'BufferError': ,
 'BytesWarning': ,
 'ChildProcessError': ,
 'ConnectionAbortedError': ,
 'ConnectionError': ,
 'ConnectionRefusedError': ,
 'ConnectionResetError': ,
 'DeprecationWarning': ,
 'EOFError': ,
 'Ellipsis': Ellipsis,
 'EnvironmentError': ,
 'Exception': ,
 'False': False,
 'FileExistsError': ,
 'FileNotFoundError': ,
 'FloatingPointError': ,
 'FutureWarning': ,
 'GeneratorExit': ,
 'IOError': ,
 'ImportError': ,
 'ImportWarning': ,
 'IndentationError': ,
 'IndexError': ,
 'InterruptedError': ,
 'IsADirectoryError': ,
 'KeyError': ,
 'KeyboardInterrupt': ,
 'LookupError': ,
 'MemoryError': ,
 'ModuleNotFoundError': ,
 'NameError': ,
 'None': None,
 'NotADirectoryError': ,
 'NotImplemented': NotImplemented,
 'NotImplementedError': ,
 'OSError': ,
 'OverflowError': ,
 'PendingDeprecationWarning': ,
 'PermissionError': ,
 'ProcessLookupError': ,
 'RecursionError': ,
 'ReferenceError': ,
 'ResourceWarning': ,
 'RuntimeError': ,
 'RuntimeWarning': ,
 'StopAsyncIteration': ,
 'StopIteration': ,
 'SyntaxError': ,
 'SyntaxWarning': ,
 'SystemError': ,
 'SystemExit': ,
 'TabError': ,
 'TimeoutError': ,
 'True': True,
 'TypeError': ,
 'UnboundLocalError': ,
 'UnicodeDecodeError': ,
 'UnicodeEncodeError': ,
 'UnicodeError': ,
 'UnicodeTranslateError': ,
 'UnicodeWarning': ,
 'UserWarning': ,
 'ValueError': ,
 'Warning': ,
 'ZeroDivisionError': ,
 '__build_class__': ,
 '__debug__': True,
 '__doc__': 'Built-in functions, exceptions, and other objects.\n'
            '\n'
            "Noteworthy: None is the `nil' object; Ellipsis represents `...' "
            'in slices.',
 '__import__': ,
 '__loader__': ,
 '__name__': 'builtins',
 '__package__': '',
 '__spec__': ModuleSpec(name='builtins', loader=),
 'abs': ,
 'all': ,
 'any': ,
 'ascii': ,
 'bin': ,
 'bool': ,
 'breakpoint': ,
 'bytearray': ,
 'bytes': ,
 'callable': ,
 'chr': ,
 'classmethod': ,
 'compile': ,
 'complex': ,
 'copyright': Copyright (c) 2001-2020 Python Software Foundation.
All Rights Reserved.

Copyright (c) 2000 BeOpen.com.
All Rights Reserved.

Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.

Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved.,
 'credits':     Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
    for supporting Python development.  See www.python.org for more information.,
 'delattr': ,
 'dict': ,
 'dir': ,
 'divmod': ,
 'enumerate': ,
 'eval': ,
 'exec': ,
 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit,
 'filter': ,
 'float': 

Assignee
Assign to
Time tracking