Skip to content

Commit

Permalink
cable_guy: add support for NetworkManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani authored and patrickelectric committed Sep 24, 2024
1 parent 4544045 commit 464b52b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions bootstrap/startup.json.default
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
"/etc/resolv.conf.host": {
"bind": "/etc/resolv.conf.host",
"mode": "ro"
},
"/var/run/dbus": {
"bind": "/var/run/dbus",
"mode": "rw"
}
},
"privileged": true
Expand Down
8 changes: 3 additions & 5 deletions core/services/cable_guy/networksetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
from sdbus_block.networkmanager import (
NetworkConnectionSettings,
NetworkDeviceGeneric,
NetworkDeviceWireless,
NetworkManager,
NetworkManagerSettings,
settings,
)
from sdbus_block.networkmanager.enums import DeviceType
from sdbus_block.networkmanager.settings.datatypes import AddressData

from typedefs import NetworkInterfaceMetric, NetworkInterfaceMetricApi

Expand Down Expand Up @@ -276,10 +274,10 @@ def set_interfaces_priority(self, interfaces: List[NetworkInterfaceMetricApi]) -


class NetworkHandlerDetector:
def __iinit__(self):
def __iinit__(self) -> None:
pass

def getHandler(self):
def getHandler(self) -> AbstractNetworkHandler:
for candidate in AbstractNetworkHandler.__subclasses__():
if candidate().detect():
logger.info(f"Detected network handler: {candidate.__name__}")
Expand Down
1 change: 1 addition & 0 deletions core/services/cable_guy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"pyroute2 == 0.5.13",
"starlette == 0.27.0",
"fastapi == 0.105.0",
"sdbus-networkmanager == 2.0.0",
# Enforce anyio fastapi subdependency to avoid conflict with starlette
"anyio == 3.7.1",
"uvicorn == 0.13.4",
Expand Down
1 change: 1 addition & 0 deletions core/tools/blueos_startup_update/blueos_startup_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"/usr/blueos/extensions": {"bind": "/usr/blueos/extensions", "mode": "rw"},
"/usr/blueos/userdata": {"bind": "/usr/blueos/userdata", "mode": "rw"},
"/var/run/wpa_supplicant": {"bind": "/var/run/wpa_supplicant", "mode": "rw"},
"/var/run/dbus": {"bind": "/var/run/dbus", "mode": "rw"},
}
}
}
Expand Down

0 comments on commit 464b52b

Please sign in to comment.