PR to fix the issue of keyerror in Nios api (#49183)

* ipv4addr keyerror fix

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* fix review comment

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
pull/50754/head
Sumit Jaiswal 6 years ago committed by GitHub
parent 3784abc96a
commit 40a806d156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -230,7 +230,8 @@ class WapiModule(WapiBase):
if ib_obj_ref:
if len(ib_obj_ref) > 1:
for each in ib_obj_ref:
if each['ipv4addr'] == proposed_object['ipv4addr']:
if ('ipv4addr' in each) and ('ipv4addr' in proposed_object)\
and each['ipv4addr'] == proposed_object['ipv4addr']:
current_object = each
else:
current_object = ib_obj_ref[0]

Loading…
Cancel
Save