Skip to content

Commit

Permalink
fixes issue with alternative json object data for network ports and f…
Browse files Browse the repository at this point in the history
…unctions on SuperMicro systems #118
  • Loading branch information
bb-Ricardo committed Sep 8, 2023
1 parent 331d76a commit 9f979d2
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions cr_module/nic.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,23 @@ def get_network_function(function_data=None):
for controller in adapter_controllers:
firmware = grab(controller, "FirmwarePackageVersion")

network_ports.extend(
grab(controller, "Links.NetworkPorts") or grab(controller, "Link.NetworkPorts")
)
network_functions.extend(
grab(controller, "Links.NetworkDeviceFunctions") or
grab(controller, "Link.NetworkDeviceFunctions") or
list()
)
this_controller_network_ports = \
grab(controller, "Links.NetworkPorts") or \
grab(controller, "Link.NetworkPorts") or list()

if isinstance(this_controller_network_ports, list):
network_ports.extend(this_controller_network_ports)
else:
network_ports.append(this_controller_network_ports)

this_controller_network_functions = \
grab(controller, "Links.NetworkDeviceFunctions") or \
grab(controller, "Link.NetworkDeviceFunctions") or list()

if isinstance(this_controller_network_functions, list):
network_functions.extend(this_controller_network_functions)
else:
network_functions.append(this_controller_network_functions)

num_ports = len(network_ports)

Expand Down

0 comments on commit 9f979d2

Please sign in to comment.