mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-06-24 10:56:30 +00:00

* Improve gdbus error handling * Fix logging type * Detect no dbus * Fix issue with complex * Update hassio/dbus/__init__.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update hassio/dbus/hostname.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update hassio/dbus/rauc.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update hassio/dbus/systemd.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Fix black
58 lines
1.5 KiB
Python
58 lines
1.5 KiB
Python
"""D-Bus interface for rauc."""
|
|
import logging
|
|
|
|
from .interface import DBusInterface
|
|
from .utils import dbus_connected
|
|
from ..exceptions import DBusError, DBusInterfaceError
|
|
from ..utils.gdbus import DBus
|
|
|
|
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
|
|
|
DBUS_NAME = "de.pengutronix.rauc"
|
|
DBUS_OBJECT = "/"
|
|
|
|
|
|
class Rauc(DBusInterface):
|
|
"""Handle D-Bus interface for rauc."""
|
|
|
|
async def connect(self):
|
|
"""Connect to D-Bus."""
|
|
try:
|
|
self.dbus = await DBus.connect(DBUS_NAME, DBUS_OBJECT)
|
|
except DBusError:
|
|
_LOGGER.warning("Can't connect to rauc")
|
|
except DBusInterfaceError:
|
|
_LOGGER.warning("Host has no rauc support. OTA updates have been disabled.")
|
|
|
|
@dbus_connected
|
|
def install(self, raucb_file):
|
|
"""Install rauc bundle file.
|
|
|
|
Return a coroutine.
|
|
"""
|
|
return self.dbus.Installer.Install(raucb_file)
|
|
|
|
@dbus_connected
|
|
def get_slot_status(self):
|
|
"""Get slot status.
|
|
|
|
Return a coroutine.
|
|
"""
|
|
return self.dbus.Installer.GetSlotStatus()
|
|
|
|
@dbus_connected
|
|
def get_properties(self):
|
|
"""Return rauc informations.
|
|
|
|
Return a coroutine.
|
|
"""
|
|
return self.dbus.get_properties(f"{DBUS_NAME}.Installer")
|
|
|
|
@dbus_connected
|
|
def signal_completed(self):
|
|
"""Return a signal wrapper for completed signal.
|
|
|
|
Return a coroutine.
|
|
"""
|
|
return self.dbus.wait_signal(f"{DBUS_NAME}.Installer.Completed")
|