Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions nebula/netbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,15 @@ def __init__( # noqa: C901
self.data["devices"].update({"power_ports": dict()})
for pow in pow_raw:
# get associated oulet
outlet_id = pow["connected_endpoint"]["id"]
outlet_id = pow["connected_endpoints"][0]["id"]
outlet = self.nbi.get_power_outlets(id=outlet_id)
pow["connected_endpoint"]["outlet"] = outlet[0]["custom_fields"]["outlet"]
outlet_number = outlet[0]["custom_fields"]["outlet"]
pow["connected_endpoints"][0]["outlet"] = outlet_number

# get ip of pdu
pdu_raw = self.nbi.get_devices(id=pow["connected_endpoint"]["device"]["id"])
pdu_raw = self.nbi.get_devices(
id=pow["connected_endpoints"][0]["device"]["id"]
)
pow["pdus"] = list()
for pdu in pdu_raw:
pow["pdus"].append(pdu)
Expand Down
2 changes: 1 addition & 1 deletion nebula/resources/template_gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pdu-config:
help: "Outlet number on PDU for dev board"
optional: True
type: int
netbox_field: devices.power_ports.input.connected_endpoint.outlet
netbox_field: devices.power_ports.input.connected_endpoints[0].outlet
field_4:
name: username
default: "username"
Expand Down
2 changes: 2 additions & 0 deletions nebula/usbmux.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def find_muxed_sdcard(self):
time.sleep(5)
context = pyudev.Context()
for device in context.list_devices(subsystem="block"):
print("WHAT")
print(device.get("ID_SERIAL_SHORT"))
if device.get("ID_SERIAL_SHORT") == os.path.basename(
self._mux_in_use
).strip("id-"):
Expand Down