Compare commits

..

No commits in common. "015e8e38b54f49c7df8d724d77d368794467c026" and "4a2433af5d828810936a7da773313ff9e4302450" have entirely different histories.

2 changed files with 32 additions and 28 deletions

View File

@ -704,24 +704,26 @@ def update_state_from_dictionaries(current_warnings, current_alarms, node_number
changed_alarms = current_alarms changed_alarms = current_alarms
is_first_update = False is_first_update = False
else: else:
changed_alarms = {} changed_alarms={}
changed_warnings = {} changed_warnings={}
# calculate the diff in warnings and alarms
prev_alarm_value_list=list(previous_alarms.values())
alarm_keys=list(previous_alarms.keys())
for key in current_alarms: for i, alarm in enumerate(current_alarms.values()):
current_value = current_alarms[key] if alarm!=prev_alarm_value_list[i]:
prev_value = previous_alarms.get(key, False) # Use False if the key doesn't exist changed_alarms[alarm_keys[i]]=True
if current_value != prev_value:
changed_alarms[key] = True
else: else:
changed_alarms[key] = False changed_alarms[alarm_keys[i]]=False
for key in current_warnings: prev_warning_value_list=list(previous_warnings.values())
current_value = current_warnings[key] warning_keys=list(previous_warnings.keys())
prev_value = previous_warnings.get(key, False)
if current_value != prev_value: for i, warning in enumerate(current_warnings.values()):
changed_warnings[key] = True if warning!=prev_warning_value_list[i]:
changed_warnings[warning_keys[i]]=True
else: else:
changed_warnings[key] = False changed_warnings[warning_keys[i]]=False
status_message = { status_message = {
"InstallationId": INSTALLATION_ID, "InstallationId": INSTALLATION_ID,

View File

@ -151,7 +151,7 @@ prev_status = 0
def update_state_from_dictionaries(current_warnings, current_alarms, node_numbers): def update_state_from_dictionaries(current_warnings, current_alarms, node_numbers):
global previous_warnings, previous_alarms, INSTALLATION_ID, PRODUCT_ID, is_first_update, channel, prev_status global previous_warnings, previous_alarms, INSTALLATION_ID, PRODUCT_ID, is_first_update, channel, prev_status
if is_first_update: if is_first_update:
changed_warnings = current_warnings changed_warnings = current_warnings
changed_alarms = current_alarms changed_alarms = current_alarms
@ -159,23 +159,25 @@ def update_state_from_dictionaries(current_warnings, current_alarms, node_number
else: else:
changed_alarms = {} changed_alarms = {}
changed_warnings = {} changed_warnings = {}
# calculate the diff in warnings and alarms
prev_alarm_value_list = list(previous_alarms.values())
alarm_keys = list(previous_alarms.keys())
for key in current_alarms: for i, alarm in enumerate(current_alarms.values()):
current_value = current_alarms[key] if alarm != prev_alarm_value_list[i]:
prev_value = previous_alarms.get(key, False) # Use False if the key doesn't exist changed_alarms[alarm_keys[i]] = True
if current_value != prev_value:
changed_alarms[key] = True
else: else:
changed_alarms[key] = False changed_alarms[alarm_keys[i]] = False
for key in current_warnings: prev_warning_value_list=list(previous_warnings.values())
current_value = current_warnings[key] warning_keys=list(previous_warnings.keys())
prev_value = previous_warnings.get(key, False)
if current_value != prev_value: for i, warning in enumerate(current_warnings.values()):
changed_warnings[key] = True if warning!=prev_warning_value_list[i]:
changed_warnings[warning_keys[i]]=True
else: else:
changed_warnings[key] = False changed_warnings[warning_keys[i]]=False
status_message = { status_message = {
"InstallationId": INSTALLATION_ID, "InstallationId": INSTALLATION_ID,
"Product": PRODUCT_ID, "Product": PRODUCT_ID,