Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Fix AttributeError in delete_nic
Browse files Browse the repository at this point in the history
  • Loading branch information
dwettstein committed Nov 12, 2020
1 parent 23388db commit 80ada95
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pyvcloud/vcd/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,13 +716,14 @@ def delete_nic(self, index):
indices = [None] * 10
nic_not_found = True
# find the nic with the given index
for nc in net_conn_section.NetworkConnection:
if int(nc.NetworkConnectionIndex.text) == index:
net_conn_section.remove(nc)
nic_not_found = False
else:
indices[int(nc.NetworkConnectionIndex.
text)] = nc.NetworkConnectionIndex.text
if hasattr(net_conn_section, 'NetworkConnection'):
for nc in net_conn_section.NetworkConnection:
if int(nc.NetworkConnectionIndex.text) == index:
net_conn_section.remove(nc)
nic_not_found = False
else:
indices[int(nc.NetworkConnectionIndex.
text)] = nc.NetworkConnectionIndex.text

if nic_not_found:
raise InvalidParameterException(
Expand Down

0 comments on commit 80ada95

Please sign in to comment.