Backport/2.5/39027 (#39091)
* nios lookup errors out when there are no results #37970 (#39027)
* Update nios.py
* Update nios.py
* Update nios.py
* nios lookup errors out when there are no results #37970 Open
Indentation failure issue resolved
* Returning empty list instead of None
In case of no results, res will be returned as an empty list instead of None (implementing ganeshrn comment)
(cherry picked from commit fd50248463
)
* Adding changelog mesage for nios lookup error
This commit is contained in:
parent
2107d91e45
commit
fb669f76fb
2 changed files with 8 additions and 3 deletions
2
changelogs/fragments/nios_lookup_errors.yaml
Normal file
2
changelogs/fragments/nios_lookup_errors.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- nio_lookup_error - fixed nios lookup errors out when there are no results
|
|
@ -114,7 +114,10 @@ class LookupModule(LookupBase):
|
|||
provider = kwargs.pop('provider', {})
|
||||
wapi = WapiLookup(provider)
|
||||
res = wapi.get_object(obj_type, filter_data, return_fields=return_fields)
|
||||
for obj in res:
|
||||
if 'extattrs' in obj:
|
||||
obj['extattrs'] = flatten_extattrs(obj['extattrs'])
|
||||
if res is not None:
|
||||
for obj in res:
|
||||
if 'extattrs' in obj:
|
||||
obj['extattrs'] = flatten_extattrs(obj['extattrs'])
|
||||
else:
|
||||
res = []
|
||||
return res
|
||||
|
|
Loading…
Reference in a new issue