Project

General

Profile

Actions

Bug #48487

closed

mgr/restful: TypeError: string indices must be integers in _gather_osds

Added by Jerry Pu over 3 years ago. Updated over 3 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
restful module
Target version:
-
% Done:

0%

Source:
Tags:
low-hanging-fruit
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

2020-12-08T11:18:29.238+0800 7fe03c4d2700  0 [restful ERROR werkzeug] Error on request:
Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/werkzeug/serving.py", line 323, in run_wsgi
    execute(self.server.app)
  File "/usr/local/lib64/python3.6/site-packages/werkzeug/serving.py", line 312, in execute
    application_iter = app(environ, start_response)
  File "/usr/local/lib/python3.6/site-packages/pecan/middleware/recursive.py", line 56, in __call__
    return self.application(environ, start_response)
  File "/usr/local/lib/python3.6/site-packages/pecan/core.py", line 852, in __call__
    return super(Pecan, self).__call__(environ, start_response)
  File "/usr/local/lib/python3.6/site-packages/pecan/core.py", line 693, in __call__
    self.invoke_controller(controller, args, kwargs, state)
  File "/usr/local/lib/python3.6/site-packages/pecan/core.py", line 584, in invoke_controller
    result = controller(*args, **kwargs)
  File "/usr/share/ceph/mgr/restful/decorators.py", line 59, in decorated
    return f(*args, **kwargs)
  File "/usr/share/ceph/mgr/restful/api/crush.py", line 21, in get
    rule['osd_count'] = len(common.crush_rule_osds(crush['buckets'], rule))
  File "/usr/share/ceph/mgr/restful/common.py", line 159, in crush_rule_osds
    osds |= _gather_osds(nodes_by_id[step['item']], rule['steps'][i + 1:])
  File "/usr/share/ceph/mgr/restful/common.py", line 135, in _gather_osds
    osds |= _gather_osds(desc_node, steps[1:])
  File "/usr/share/ceph/mgr/restful/common.py", line 122, in _gather_osds
    if root['id'] >= 0:
TypeError: string indices must be integers

In _gather_osds() processing `choose_firstn`, it tries to traverse the keys of a `dict` (nodes_by_id[node_id]) which is not a real node, thus mistakenly passing `str` to _gather_osds() to do recursion.


Related issues 1 (0 open1 closed)

Is duplicate of mgr - Bug #48488: mgr/restful: _gather_osds() mistakenly treats a `str` as a `dict`ResolvedJerry Pu

Actions
Actions #1

Updated by Neha Ojha over 3 years ago

  • Subject changed from mgr/restful: to mgr/restful: TypeError: string indices must be integers in _gather_osds
  • Tags set to low-hanging-fruit
Actions #2

Updated by Jerry Pu over 3 years ago

Sorry, this is a duplicate ticket of #48488 created by mistake.

Actions #3

Updated by Nathan Cutler over 3 years ago

  • Is duplicate of Bug #48488: mgr/restful: _gather_osds() mistakenly treats a `str` as a `dict` added
Actions #4

Updated by Nathan Cutler over 3 years ago

  • Status changed from New to Duplicate
Actions

Also available in: Atom PDF