From c18a7865c6f3605aa3abfe2dcf83723fc1955108 Mon Sep 17 00:00:00 2001 From: Dan Voiculeasa Date: Thu, 17 Jun 2021 17:33:55 +0300 Subject: [PATCH] Fix fm alarm-list and fm alarm-summary Fixed a typo for accessing a configuration resource. Fixed a python3 script called by fmManager on initialization. It was modifying a dictionary while parsing it using an iterator, which doesn't guarantee all initial elements are visited. The fm database event_suppression table was left in a bad state, thus alarm list and alarm summary were empty. Tests: - build and deploy from iso - tested with the fm_api_test.py provided in the repo - tested some of the commands by raising a config out of date and targeting the raised alarm - fm alarm-list, alarm-delete, alarm-show, alarm-summary, event-list, event-show, event-suppress-list, event-suppress, event-unsuppress, event-unsuppress-all produce relevant output Story: 2008454 Task: 42632 Depends-On: I2d0f4c2c85ea8057258d56632a102b2eac7db388 Signed-off-by: Dan Voiculeasa Change-Id: Ib3d5276c4a669a3f3f123470c31edf7a07751eaa --- fm-common/sources/fm_db_sync_event_suppression.py | 2 +- fm-rest-api/fm/fm/api/controllers/v1/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fm-common/sources/fm_db_sync_event_suppression.py b/fm-common/sources/fm_db_sync_event_suppression.py index badc6aa9..ee7ff21c 100755 --- a/fm-common/sources/fm_db_sync_event_suppression.py +++ b/fm-common/sources/fm_db_sync_event_suppression.py @@ -109,7 +109,7 @@ if not os.path.isfile(EVENT_TYPES_FILE): with open(EVENT_TYPES_FILE, 'r') as stream: event_types = yaml.load(stream) -for alarm_id in event_types: +for alarm_id in list(event_types.keys()): if isinstance(alarm_id, float): # force 3 digits after the decimal point, # to include trailing zero's (ex.: 200.010) diff --git a/fm-rest-api/fm/fm/api/controllers/v1/utils.py b/fm-rest-api/fm/fm/api/controllers/v1/utils.py index 4370bdd7..fadbea68 100644 --- a/fm-rest-api/fm/fm/api/controllers/v1/utils.py +++ b/fm-rest-api/fm/fm/api/controllers/v1/utils.py @@ -59,7 +59,7 @@ def validate_limit(limit): if limit: return min(CONF.api.limit_max, limit) or CONF.api.limit_max else: - return CONF.api_limit_max + return CONF.api.limit_max def validate_sort_dir(sort_dir):