Fix tracebacks with search_obj_in_list (#67389)
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
This commit is contained in:
parent
c1d8bdb87a
commit
5ca7a9ea26
1 changed files with 6 additions and 4 deletions
|
@ -596,10 +596,12 @@ def validate_config(spec, data):
|
|||
|
||||
|
||||
def search_obj_in_list(name, lst, key='name'):
|
||||
for item in lst:
|
||||
if item.get(key) == name:
|
||||
return item
|
||||
return None
|
||||
if not lst:
|
||||
return None
|
||||
else:
|
||||
for item in lst:
|
||||
if item.get(key) == name:
|
||||
return item
|
||||
|
||||
|
||||
class Template:
|
||||
|
|
Loading…
Reference in a new issue