diff --git a/pyvcloud/vcd/vm.py b/pyvcloud/vcd/vm.py index 5ad1ec4a0..4e700ac03 100644 --- a/pyvcloud/vcd/vm.py +++ b/pyvcloud/vcd/vm.py @@ -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(