Skip to content

Commit

Permalink
Added load_unit_obj wrapper function such as get_unit_obj.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raman Rakavets authored and bernhardkaindl committed May 24, 2023
1 parent 3b16a8c commit f9b30d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sdbus_async/systemd/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ def __init__(self, bus: Optional[SdBus] = None) -> None:

async def get_unit_obj(self, name: str) -> SystemdUnit:
object_path = await self.get_unit(name)
return SystemdUnit(object_path)
return SystemdUnit(object_path, self._attached_bus)

async def load_unit_obj(self, name: str) -> SystemdUnit:
object_path = await self.load_unit(name)
return SystemdUnit(object_path, self._attached_bus)


class SystemdUnit(SystemdUnitInterfaceAsync):
Expand Down
6 changes: 5 additions & 1 deletion sdbus_block/systemd/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ def __init__(self, bus: Optional[SdBus] = None) -> None:

def get_unit_obj(self, name: str) -> SystemdUnit:
object_path = self.get_unit(name)
return SystemdUnit(object_path)
return SystemdUnit(object_path, self._attached_bus)

def load_unit_obj(self, name: str) -> SystemdUnit:
object_path = self.load_unit(name)
return SystemdUnit(object_path, self._attached_bus)


class SystemdUnit(SystemdUnitInterface):
Expand Down

0 comments on commit f9b30d6

Please sign in to comment.