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
  • #1833
Closed
Open
Issue created May 05, 2022 by Vladimir@bobah63rusContributor

Create managed object -> error code 500

Чистая установка. Попытка сохранения нового managed object завершается кодом 500. Трейс из консоли браузера (firefox 85.0b4) ниже

UNHANDLED EXCEPTION (2022-05-05 12:54:17.564038)
PROCESS: ./services/web/service.py
VERSION: 22.1
BRANCH: HEAD CHANGESET: e02154f5
ERROR FINGERPRINT: 155e5f41-b24d-587f-8144-1f94cbb72b30
WORKING DIRECTORY: /opt/noc
EXCEPTION: <class 'TypeError'> Type is not JSON serializable: ObjectId
START OF TRACEBACK
------------------------------------------------------------------------
File: lib/app/extapplication.py (Line: 111)
Function: response
  104     
  105         def deserialize_form(self, request):
  106             return {str(k): v[0] if len(v) == 1 else v for k, v in request.POST.lists()}
  107     
  108         def response(self, content="", status=200):
  109             if not isinstance(content, str):
  110                 return HttpResponse(
  111 ==>                 orjson.dumps(content, option=orjson.OPT_SERIALIZE_NUMPY | orjson.OPT_NON_STR_KEYS),
  112                     content_type="text/json; charset=utf-8",
  113                     status=status,
  114                 )
  115             else:
  116                 return HttpResponse(content, content_type="text/plain; charset=utf-8", status=status)
  117     
Variables:
                self = 
<noc.services.web.apps.sa.managedobject.views.ManagedObjectApplication object at 0x7f34e6e39eb0>
             content = 
{'access_preference': 'P',
 'address': '1.1.1.1',
 'address_resolution_policy': 'P',
 'adm_path': [1],
 'administrative_domain': 1,
 'administrative_domain__label': 'default',
 'affected_maintenances': '{}',
 'auth_profile': None,
 'auth_profile__label': '',
 'autosegmentation_policy': 'p',
 'bi_id': '7142177022131340970',
 'box_discovery_alarm_policy': 'P',
 'box_discovery_running_policy': 'P',
 'box_discovery_telemetry_policy': 'P',
 'box_discovery_telemetry_sample': 0,
 'caps': [],
 'caps_discovery_policy': 'P',
 'cli_privilege_policy': 'P',
 'cli_session_policy': 'P',
 'confdb_raw_policy': 'P',
 'config_diff_filter_handler': None,
 'config_diff_filter_handler__label': '',
 'config_fetch_policy': 'P',
 'config_filter_handler': None,
 'config_filter_handler__label': '',
 'config_policy': 'P',
 'config_validation_handler': None,
 'config_validation_handler__label': '',
 'container': None,
 'container__label': '',
 'container_path': [],
 'controller': None,
 'controller__label': '',
 'default_zoom': None,
 'denied_firmware_policy': 'P',
 'description': None,
 'dlm_windows': [],
 'dynamic_classification_policy': 'P',
 'effective_client_groups': [],
 'effective_labels': [{'badges': ['fa-ils'],
                       'bg_color1': '#ffffff',
                       'bg_color2': '#ffffff',
                       'fg_color1': '#000000',
                       'fg_color2': '#000000',
                       'id': 'noc::is_managed::=',
                       'is_protected': False,
                       'name': 'noc::is_managed::=',
                       'scope': 'noc::is_managed',
                       'value': '='},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#ffffff',
                       'bg_color2': '#ffffff',
                       'fg_color1': '#000000',
                       'fg_color2': '#000000',
                       'id': 'noc::managedobjectprofile::default::=',
                       'is_protected': False,
                       'name': 'noc::managedobjectprofile::default::=',
                       'scope': 'noc::managedobjectprofile::default',
                       'value': '='},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#ffffff',
                       'bg_color2': '#ffffff',
                       'fg_color1': '#000000',
                       'fg_color2': '#000000',
                       'id': 'noc::adm_domain::default::=',
                       'is_protected': False,
                       'name': 'noc::adm_domain::default::=',
                       'scope': 'noc::adm_domain::default',
                       'value': '='},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#ffffff',
                       'bg_color2': '#ffffff',
                       'fg_color1': '#000000',
                       'fg_color2': '#000000',
                       'id': 'noc::adm_domain::default::<',
                       'is_protected': False,
                       'name': 'noc::adm_domain::default::<',
                       'scope': 'noc::adm_domain::default',
                       'value': '<'},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#000000',
                       'bg_color2': '#000000',
                       'fg_color1': '#ffffff',
                       'fg_color2': '#ffffff',
                       'id': 'noc::pool::default::=',
                       'is_protected': False,
                       'name': 'noc::pool::default::=',
                       'scope': 'noc::pool::default',
                       'value': '='},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#000000',
                       'bg_color2': '#000000',
                       'fg_color1': '#ffffff',
                       'fg_color2': '#ffffff',
                       'id': 'noc::profile::Generic.Host::=',
                       'is_protected': False,
                       'name': 'noc::profile::Generic.Host::=',
                       'scope': 'noc::profile::Generic.Host',
                       'value': '='}],
 'effective_service_groups': [],
 'escalation_policy': 'P',
 'event_processing_policy': 'P',
 'fm_pool': None,
 'fm_pool__label': '',
 'fqdn': None,
 'global_cpe_id': None,
 'id': 4,
 'interface_discovery_policy': 'P',
 'is_managed': True,
 'l2_domain': None,
 'l2_domain__label': '',
 'labels': [],
 'last_seen': None,
 'links': [],
 'local_cpe_id': None,
 'max_scripts': 0,
 'name': 'test',
 'next_version': None,
 'next_version__label': '',
 'object_profile': 1,
 'object_profile__label': 'default',
 'password': 'test',
 'periodic_discovery_alarm_policy': 'P',
 'periodic_discovery_running_policy': 'P',
 'periodic_discovery_telemetry_policy': 'P',
 'periodic_discovery_telemetry_sample': 0,
 'platform': None,
 'platform__label': '',
 'pool': '627397538fc1b30db9b630a9',
 'pool__label': 'default',
 'port': 0,
 'profile': '627395da77e8fba70756e0d2',
 'profile__label': 'Generic.Host',
 'project': None,
 'project__label': '',
 'rca_neighbors': [],
 'remote_id': None,
 'remote_path': None,
 'remote_system': None,
 'remote_system__label': '',
 'row_class': '',
 'scheme': 1,
 'segment': '627395b93e965d5445d711d4',
 'segment__label': 'ALL',
 'segment_path': [ObjectId('627395b93e965d5445d711d4')],
 'shape_overlay_form': None,
 'shape_overlay_glyph': None,
 'shape_overlay_glyph__label': '',
 'shape_overlay_position': None,
 'snmp_rate_limit': 0,
 'snmp_ro': 'test',
 'snmp_rw': None,
 'software_image': None,
 'static_client_groups': [],
 'static_service_groups': [],
 'super_password': None,
 'syslog_archive_policy': 'P',
 'syslog_source_ip': None,
 'syslog_source_type': 'd',
 'time_pattern': None,
 'time_pattern__label': '',
 'trap_community': None,
 'trap_source_ip': None,
 'trap_source_type': 'd',
 'tt_queue': None,
 'tt_system': None,
 'tt_system__label': '',
 'tt_system_id': None,
 'uplinks': [],
 'user': 'test',
 'vc_domain': None,
 'vc_domain__label': '',
 'vendor': None,
 'vendor__label': '',
 'version': None,
 'version__label': '',
 'vlan_discovery_policy': 'P',
 'vrf': None,
 'vrf__label': '',
 'x': None,
 'y': None}
              status = 201
------------------------------------------------------------------------
File: lib/app/extmodelapplication.py (Line: 647)
Function: api_create
  640                         {"status": False, "message": "Integrity error: %s" % e}, status=self.CONFLICT
  641                     )
  642                 # Check format
  643                 if request.is_extjs:
  644                     rs = {"success": True, "data": self.instance_to_dict(o)}
  645                 else:
  646                     rs = self.instance_to_dict(o)
  647 ==>             return self.response(rs, status=self.CREATED)
  648     
  649         @view(method=["GET"], url=r"^(?P<id>\d+)/?$", access="read", api=True)
  650         def api_read(self, request, id):
  651             """
  652             Returns dict with object's fields and values
  653             """
Variables:
                self = 
<noc.services.web.apps.sa.managedobject.views.ManagedObjectApplication object at 0x7f34e6e39eb0>
             request = <WSGIRequest: POST '/sa/managedobject/'>
           m2m_attrs = {}
          file_attrs = {}
              qattrs = 
{'access_preference': 'P',
 'address': '1.1.1.1',
 'address_resolution_policy': 'P',
 'administrative_domain': <AdministrativeDomain: default>,
 'auth_profile': None,
 'autosegmentation_policy': 'p',
 'box_discovery_alarm_policy': 'P',
 'box_discovery_running_policy': 'P',
 'box_discovery_telemetry_policy': 'P',
 'box_discovery_telemetry_sample': 0,
 'caps_discovery_policy': 'P',
 'cli_privilege_policy': 'P',
 'cli_session_policy': 'P',
 'confdb_raw_policy': 'P',
 'config_diff_filter_handler': None,
 'config_fetch_policy': 'P',
 'config_filter_handler': None,
 'config_policy': 'P',
 'config_validation_handler': None,
 'controller': None,
 'denied_firmware_policy': 'P',
 'description': None,
 'dynamic_classification_policy': 'P',
 'effective_client_groups': [],
 'effective_service_groups': [],
 'escalation_policy': 'P',
 'event_processing_policy': 'P',
 'fm_pool': None,
 'fqdn': None,
 'global_cpe_id': None,
 'interface_discovery_policy': 'P',
 'is_managed': True,
 'l2_domain': None,
 'labels': [],
 'last_seen': None,
 'local_cpe_id': None,
 'max_scripts': 0,
 'name': 'test',
 'next_version': None,
 'object_profile': <ManagedObjectProfile: default>,
 'password': 'test',
 'periodic_discovery_alarm_policy': 'P',
 'periodic_discovery_running_policy': 'P',
 'periodic_discovery_telemetry_policy': 'P',
 'periodic_discovery_telemetry_sample': 0,
 'platform': None,
 'pool': '627397538fc1b30db9b630a9',
 'port': 0,
 'profile': '627395da77e8fba70756e0d2',
 'project': None,
 'remote_id': None,
 'remote_path': None,
 'remote_system': None,
 'scheme': 1,
 'segment': '627395b93e965d5445d711d4',
 'shape': None,
 'shape_overlay_form': None,
 'shape_overlay_glyph': None,
 'shape_overlay_position': None,
 'snmp_rate_limit': 0,
 'snmp_ro': 'test',
 'snmp_rw': None,
 'software_image': None,
 'static_client_groups': [],
 'static_service_groups': [],
 'super_password': None,
 'syslog_archive_policy': 'P',
 'syslog_source_ip': None,
 'syslog_source_type': 'd',
 'time_pattern': None,
 'trap_community': None,
 'trap_source_ip': None,
 'trap_source_type': 'd',
 'tt_queue': None,
 'tt_system': None,
 'tt_system_id': None,
 'user': 'test',
 'vc_domain': None,
 'vendor': None,
 'version': None,
 'vlan_discovery_policy': 'P',
 'vrf': None}
                   o = <ManagedObject: test>
                  rs = 
{'access_preference': 'P',
 'address': '1.1.1.1',
 'address_resolution_policy': 'P',
 'adm_path': [1],
 'administrative_domain': 1,
 'administrative_domain__label': 'default',
 'affected_maintenances': '{}',
 'auth_profile': None,
 'auth_profile__label': '',
 'autosegmentation_policy': 'p',
 'bi_id': '7142177022131340970',
 'box_discovery_alarm_policy': 'P',
 'box_discovery_running_policy': 'P',
 'box_discovery_telemetry_policy': 'P',
 'box_discovery_telemetry_sample': 0,
 'caps': [],
 'caps_discovery_policy': 'P',
 'cli_privilege_policy': 'P',
 'cli_session_policy': 'P',
 'confdb_raw_policy': 'P',
 'config_diff_filter_handler': None,
 'config_diff_filter_handler__label': '',
 'config_fetch_policy': 'P',
 'config_filter_handler': None,
 'config_filter_handler__label': '',
 'config_policy': 'P',
 'config_validation_handler': None,
 'config_validation_handler__label': '',
 'container': None,
 'container__label': '',
 'container_path': [],
 'controller': None,
 'controller__label': '',
 'default_zoom': None,
 'denied_firmware_policy': 'P',
 'description': None,
 'dlm_windows': [],
 'dynamic_classification_policy': 'P',
 'effective_client_groups': [],
 'effective_labels': [{'badges': ['fa-ils'],
                       'bg_color1': '#ffffff',
                       'bg_color2': '#ffffff',
                       'fg_color1': '#000000',
                       'fg_color2': '#000000',
                       'id': 'noc::is_managed::=',
                       'is_protected': False,
                       'name': 'noc::is_managed::=',
                       'scope': 'noc::is_managed',
                       'value': '='},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#ffffff',
                       'bg_color2': '#ffffff',
                       'fg_color1': '#000000',
                       'fg_color2': '#000000',
                       'id': 'noc::managedobjectprofile::default::=',
                       'is_protected': False,
                       'name': 'noc::managedobjectprofile::default::=',
                       'scope': 'noc::managedobjectprofile::default',
                       'value': '='},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#ffffff',
                       'bg_color2': '#ffffff',
                       'fg_color1': '#000000',
                       'fg_color2': '#000000',
                       'id': 'noc::adm_domain::default::=',
                       'is_protected': False,
                       'name': 'noc::adm_domain::default::=',
                       'scope': 'noc::adm_domain::default',
                       'value': '='},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#ffffff',
                       'bg_color2': '#ffffff',
                       'fg_color1': '#000000',
                       'fg_color2': '#000000',
                       'id': 'noc::adm_domain::default::<',
                       'is_protected': False,
                       'name': 'noc::adm_domain::default::<',
                       'scope': 'noc::adm_domain::default',
                       'value': '<'},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#000000',
                       'bg_color2': '#000000',
                       'fg_color1': '#ffffff',
                       'fg_color2': '#ffffff',
                       'id': 'noc::pool::default::=',
                       'is_protected': False,
                       'name': 'noc::pool::default::=',
                       'scope': 'noc::pool::default',
                       'value': '='},
                      {'badges': ['fa-ils'],
                       'bg_color1': '#000000',
                       'bg_color2': '#000000',
                       'fg_color1': '#ffffff',
                       'fg_color2': '#ffffff',
                       'id': 'noc::profile::Generic.Host::=',
                       'is_protected': False,
                       'name': 'noc::profile::Generic.Host::=',
                       'scope': 'noc::profile::Generic.Host',
                       'value': '='}],
 'effective_service_groups': [],
 'escalation_policy': 'P',
 'event_processing_policy': 'P',
 'fm_pool': None,
 'fm_pool__label': '',
 'fqdn': None,
 'global_cpe_id': None,
 'id': 4,
 'interface_discovery_policy': 'P',
 'is_managed': True,
 'l2_domain': None,
 'l2_domain__label': '',
 'labels': [],
 'last_seen': None,
 'links': [],
 'local_cpe_id': None,
 'max_scripts': 0,
 'name': 'test',
 'next_version': None,
 'next_version__label': '',
 'object_profile': 1,
 'object_profile__label': 'default',
 'password': 'test',
 'periodic_discovery_alarm_policy': 'P',
 'periodic_discovery_running_policy': 'P',
 'periodic_discovery_telemetry_policy': 'P',
 'periodic_discovery_telemetry_sample': 0,
 'platform': None,
 'platform__label': '',
 'pool': '627397538fc1b30db9b630a9',
 'pool__label': 'default',
 'port': 0,
 'profile': '627395da77e8fba70756e0d2',
 'profile__label': 'Generic.Host',
 'project': None,
 'project__label': '',
 'rca_neighbors': [],
 'remote_id': None,
 'remote_path': None,
 'remote_system': None,
 'remote_system__label': '',
 'row_class': '',
 'scheme': 1,
 'segment': '627395b93e965d5445d711d4',
 'segment__label': 'ALL',
 'segment_path': [ObjectId('627395b93e965d5445d711d4')],
 'shape_overlay_form': None,
 'shape_overlay_glyph': None,
 'shape_overlay_glyph__label': '',
 'shape_overlay_position': None,
 'snmp_rate_limit': 0,
 'snmp_ro': 'test',
 'snmp_rw': None,
 'software_image': None,
 'static_client_groups': [],
 'static_service_groups': [],
 'super_password': None,
 'syslog_archive_policy': 'P',
 'syslog_source_ip': None,
 'syslog_source_type': 'd',
 'time_pattern': None,
 'time_pattern__label': '',
 'trap_community': None,
 'trap_source_ip': None,
 'trap_source_type': 'd',
 'tt_queue': None,
 'tt_system': None,
 'tt_system__label': '',
 'tt_system_id': None,
 'uplinks': [],
 'user': 'test',
 'vc_domain': None,
 'vc_domain__label': '',
 'vendor': None,
 'vendor__label': '',
 'version': None,
 'version__label': '',
 'vlan_discovery_policy': 'P',
 'vrf': None,
 'vrf__label': '',
 'x': None,
 'y': None}
               attrs = 
{'access_preference': 'P',
 'address': '1.1.1.1',
 'address_resolution_policy': 'P',
 'administrative_domain': <AdministrativeDomain: default>,
 'auth_profile': None,
 'autosegmentation_policy': 'p',
 'box_discovery_alarm_policy': 'P',
 'box_discovery_running_policy': 'P',
 'box_discovery_telemetry_policy': 'P',
 'box_discovery_telemetry_sample': 0,
 'caps_discovery_policy': 'P',
 'cli_privilege_policy': 'P',
 'cli_session_policy': 'P',
 'confdb_raw_policy': 'P',
 'config_diff_filter_handler': None,
 'config_fetch_policy': 'P',
 'config_filter_handler': None,
 'config_policy': 'P',
 'config_validation_handler': None,
 'controller': None,
 'denied_firmware_policy': 'P',
 'description': None,
 'dynamic_classification_policy': 'P',
 'effective_client_groups': [],
 'effective_service_groups': [],
 'escalation_policy': 'P',
 'event_processing_policy': 'P',
 'fm_pool': None,
 'fqdn': None,
 'global_cpe_id': None,
 'interface_discovery_policy': 'P',
 'is_managed': True,
 'l2_domain': None,
 'labels': [],
 'last_seen': None,
 'local_cpe_id': None,
 'max_scripts': 0,
 'name': 'test',
 'next_version': None,
 'object_profile': <ManagedObjectProfile: default>,
 'password': 'test',
 'periodic_discovery_alarm_policy': 'P',
 'periodic_discovery_running_policy': 'P',
 'periodic_discovery_telemetry_policy': 'P',
 'periodic_discovery_telemetry_sample': 0,
 'platform': None,
 'pool': '627397538fc1b30db9b630a9',
 'port': 0,
 'profile': '627395da77e8fba70756e0d2',
 'project': None,
 'remote_id': None,
 'remote_path': None,
 'remote_system': None,
 'scheme': 1,
 'segment': '627395b93e965d5445d711d4',
 'shape': None,
 'shape_overlay_form': None,
 'shape_overlay_glyph': None,
 'shape_overlay_position': None,
 'snmp_rate_limit': 0,
 'snmp_ro': 'test',
 'snmp_rw': None,
 'software_image': None,
 'static_client_groups': [],
 'static_service_groups': [],
 'super_password': None,
 'syslog_archive_policy': 'P',
 'syslog_source_ip': None,
 'syslog_source_type': 'd',
 'time_pattern': None,
 'trap_community': None,
 'trap_source_ip': None,
 'trap_source_type': 'd',
 'tt_queue': None,
 'tt_system': None,
 'tt_system_id': None,
 'user': 'test',
 'vc_domain': None,
 'vendor': None,
 'version': None,
 'vlan_discovery_policy': 'P',
 'vrf': None}
------------------------------------------------------------------------
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 '/sa/managedobject/'>
                args = ()
              kwargs = {}
                   v = 
<bound method ExtModelApplication.api_create of <noc.services.web.apps.sa.managedobject.views.ManagedObjectApplication object at 0x7f34e6e39eb0>>
     to_log_api_call = False
          app_logger = <Logger sa.managedobject (INFO)>
                  nq = <function Site.site_view.<locals>.inner.<locals>.nq at 0x7f34e65f6d30>
       DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
  InterfaceTypeError = <class 'ValueError'>
    PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
                 app = 
<noc.services.web.apps.sa.managedobject.views.ManagedObjectApplication object at 0x7f34e6e39eb0>
                self = <noc.lib.app.site.Site object at 0x7f3504d31610>
            view_map = 
{'GET': <bound method ExtModelApplication.api_list of <noc.services.web.apps.sa.managedobject.views.ManagedObjectApplication object at 0x7f34e6e39eb0>>,
 'POST': <bound method ExtModelApplication.api_create of <noc.services.web.apps.sa.managedobject.views.ManagedObjectApplication object at 0x7f34e6e39eb0>>}
------------------------------------------------------------------------
END OF TRACEBACK
Edited May 05, 2022 by Vladimir
Assignee
Assign to
Time tracking