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 450
    • Issues 450
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 27
    • Merge requests 27
  • 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
  • #1704
Closed
Open
Issue created Nov 01, 2021 by Sergey Alekseev@komstar

Не работает отчет Latest Changes

Не работает отчет Latest Changes (Configuration Management -> Reports -> Latest Changes). В опциях выбираю 2 дня (можно указать любое, на ошибку не влияет - всегда появляется одинаковая), Type ставлю config, в поле "Managed Objects Administrative Domain (for config only)" ставлю default (у меня там коммутаторы).

Version: 20.4+master

Нажимаю generate, мгновенно появляется следующая ошибка (копию в более читаемом виде выкладываю на pastebin):

UNHANDLED EXCEPTIO
N (2021-11-01 16:28:29.940372)
PROCESS: ./services/web/service.py
VERSION: 20.4+master.465.841abc21
BRANCH: master CHANGESET: 841abc21
ERROR FINGERPRINT: 2776fa45-a9db-52a2-aa1e-d6d64aea8960
WORKING DIRECTORY: /opt/noc
EXCEPTION: <class ValueError> too many values to unpack (expected 2)
START OF TRACEBACK

File: services/web/apps/cm/reportlatestchanges/views.py (Line: 98)

Function: get_data

   91                     n_map = {

   92                         x[0]: x[1:]

   93                         for x in DNSZone.objects.filter(id__in=list(seen_ids)).values_list(

   94                             "id", "name", "address", "profile"

   95                         )

   96                     }

   97                 for d in data:

   98 ==>                 name, profile = n_map.get(d["_id"], ("-", None))

   99                     result += [

  100                         (d["_id"], name, Profile.get_by_id(profile) if profile else "-", d["last_ts"])

  101                     ]

  102             return self.from_dataset(

  103                 title="%s: %s in %d days" % (self.title, repo, days),

  104                 columns=[

Variables:              self = 

<noc.services.web.apps.cm.reportlatestchanges.views.ReportLatestChangesApplication object at 0x7f9d42f035e0>
request = <WSGIRequest: POST /cm/reportlatestchanges/>
repo = config
days = 5
adm_domain = [1]
managed_object = ''
kwargs = {}
baseline = datetime.datetime(2021, 10, 27, 16, 28, 29, 926223)
coll = 
Collection(Database(MongoClient(host=['172.x.x.x:27017'], document_class=dict, tz_aware=False, connect=True, 
read_preference=Primary(), replicaset='noc', readpreference='secondaryPreferred', maxidletimems=60000), 'noc'), 
'noc.gridvcs.config.files')
pipeline = 
[{'$match': {'object': {'$in': [6,
                                13,
                                14,
                                12,
                                16,
                                17,
                                15,
                                10,
                                11,
                                30,
                                1,
                                7,
                                9,
                                4,
                                19,
                                18,
                                20,
                                21,
                                22,
                                23,
                                25,
                                24,
                                26,
                                27,
                                28,
                                29,
                                8]}}},
 {'$match': {'ts': {'$gte': datetime.datetime(2021, 10, 27, 16, 28, 29, 926223)}}},
 {'$group': {'_id': '$object', 'last_ts': {'$max': '$ts'}}},
 {'$sort': {'_id': 1}}]
             objects = 
<QuerySet [<ManagedObject: switch1>, ...., '...(remaining elements truncated)...']>
                data = 
[{'_id': 10, 'last_ts': datetime.datetime(2021, 10, 30, 3, 57, 19, 640000)},
 {'_id': 11, 'last_ts': datetime.datetime(2021, 10, 28, 4, 30, 31, 300000)},
 {'_id': 12, 'last_ts': datetime.datetime(2021, 10, 29, 11, 23, 13, 725000)},
 {'_id': 22, 'last_ts': datetime.datetime(2021, 10, 28, 1, 17, 34, 311000)},
 {'_id': 23, 'last_ts': datetime.datetime(2021, 10, 27, 20, 52, 17, 982000)},
 {'_id': 28, 'last_ts': datetime.datetime(2021, 10, 29, 18, 22, 34, 469000)},
 {'_id': 29, 'last_ts': datetime.datetime(2021, 10, 31, 23, 33, 54, 190000)}]
              result = []
            seen_ids = [10, 11, 12, 22, 23, 28, 29]
               n_map = 
{10: ('asd', '172.x.x.1', '5fd38a9db3bf1473358e7378'),
 11: ('asd1', '172.x.x.2', '5fd38a9db3bf1473358e7378'),
 12: ('asd2', '172.x.x.3', '5fd38a9db3bf1473358e738a'),
 22: ('asd3', '172.x.x.4', '5fd38a9db3bf1473358e73c2'),
 23: ('asd4', '172.x.x.5', '5fd38a9db3bf1473358e73c2'),
 28: ('asd5', '172.x.x.6', '5fd38a9db3bf1473358e74cc'),
 29: ('asd6', '172.x.x.7', '5fd38a9db3bf1473358e74cc')}
                   d = 
{'_id': 10, 'last_ts': datetime.datetime(2021, 10, 30, 3, 57, 19, 640000)}
Edited Nov 01, 2021 by Andrey Vertiprahov
Assignee
Assign to
Time tracking