Skip to content

Commit 8e2b9d0

Browse files
authored
Merge pull request #366 from CllaudiaB/network_interfaces
Network interfaces
2 parents aadb490 + 299d141 commit 8e2b9d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

netbox_agent/network.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def create_netbox_nic(self, nic, mgmt=False):
328328
if nic["mtu"]:
329329
params["mtu"] = nic["mtu"]
330330

331-
if nic["ethtool"] and nic["ethtool"].get("link") == "no":
331+
if nic.get("ethtool") and nic["ethtool"].get("link") == "no":
332332
params["enabled"] = False
333333

334334
interface = self.nb_net.interfaces.create(**params)
@@ -510,6 +510,7 @@ def batched(it, n):
510510
# update each nic
511511
for nic in self.nics:
512512
interface = self.get_netbox_network_card(nic)
513+
513514
if not interface:
514515
logging.info(
515516
"Interface {nic} not found, creating..".format(nic=self._nic_identifier(nic))
@@ -555,7 +556,7 @@ def batched(it, n):
555556
interface.mtu = nic["mtu"]
556557
nic_update += 1
557558

558-
if nic.get("ethtool"):
559+
if not isinstance(self, VirtualNetwork) and nic.get("ethtool"):
559560
if (
560561
nic["ethtool"]["duplex"] != "-"
561562
and interface.duplex != nic["ethtool"]["duplex"].lower()

0 commit comments

Comments
 (0)