Skip to content

statuspal: Replace flatdict.FlatterDict #1044

@ma-benedetti

Description

@ma-benedetti

In 5b2d2cc the flatdict dependency was removed as it broke builds for the new RHEL 10, SLE 15 and SLE 16 targets. (A newer version of flatdict cannot be used as it requires Python 3.10 and therefore does not work on older targets such as RHEL 8)
As a consequence the statuspal plugin is currently broken (this is the only plugin where flatdict is used).

The following usage of FlatterDict in the plugin needs to be replaced with another approach to traverse the nested dictionaries:

# services - search for any incidents in services
flattened_result = flatdict.FlatterDict(result['services'])
item = {}
for key, value in flattened_result.items():
if key.endswith(':name'):
item['name'] = concat_values(flattened_result, key)
if key.endswith(':current_incident_type'):
item['state'] = statuspalstate2state(value)
if item['state'] == STATE_WARN:
cnt_warn += 1
if item['state'] == STATE_CRIT:
cnt_crit += 1
item['state'] = lib.base.state2str(item['state'], empty_ok=False)
if len(item) == 2:
table_data.append(item)
item = {}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions