Add parsing check when Context field is empty
This change adds a parsing check to ERROR if Context field is Empty. Until now there had not been a requirement of non empty fields, so in case this is needed in the future for other key/values, a collection is created. Test plan PASS: * Add/modify an alarm/log in events.yaml file with Context field set to <Empty>. * Run the checkEventYaml script and check it fails. PASS: * Check that all the events in events.yaml file have the Context field set to a non empty value. * Run the checkEventYaml script and check it ends successfully. Closes-bug: 2020381 Signed-off-by: Agustin Carranza <agustin.carranza@windriver.com> Change-Id: Ia267886dd49099525751165975fb5d291c0c6f82
This commit is contained in:
parent
82bcc2d0a5
commit
6438565a4d
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2016-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2016-2023 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
@ -103,6 +103,10 @@ logFields = {
|
|||
context_FieldName: context_FieldValues
|
||||
}
|
||||
|
||||
nonEmptyFields = {
|
||||
context_FieldName
|
||||
}
|
||||
|
||||
|
||||
def checkField(fieldKey, fieldValues, key, event):
|
||||
if fieldKey not in event:
|
||||
|
@ -110,6 +114,10 @@ def checkField(fieldKey, fieldValues, key, event):
|
|||
return False
|
||||
# print("START: %s :END" % event[fieldKey])
|
||||
|
||||
if fieldKey in nonEmptyFields and not event[fieldKey]:
|
||||
print("\n ERROR: \'%s\' can not be empty." % (fieldKey))
|
||||
return False
|
||||
|
||||
if type(event[fieldKey]) is str:
|
||||
if not fieldValues:
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue