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)
pull/39085/head
Sumit Jaiswal 7 years ago committed by Chris Alfonso
parent fafceb9895
commit fd50248463

@ -108,7 +108,10 @@ class LookupModule(LookupBase):
provider = kwargs.pop('provider', {}) provider = kwargs.pop('provider', {})
wapi = WapiLookup(provider) wapi = WapiLookup(provider)
res = wapi.get_object(obj_type, filter_data, return_fields=return_fields) res = wapi.get_object(obj_type, filter_data, return_fields=return_fields)
for obj in res: if res is not None:
if 'extattrs' in obj: for obj in res:
obj['extattrs'] = flatten_extattrs(obj['extattrs']) if 'extattrs' in obj:
obj['extattrs'] = flatten_extattrs(obj['extattrs'])
else:
res = []
return res return res

Loading…
Cancel
Save