Update info.py

This commit is contained in:
Pascal Vizeli 2018-04-26 11:32:15 +02:00 committed by GitHub
parent a59245e6bb
commit 94fba7e175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,16 +42,8 @@ class InfoCenter(CoreSysAttributes):
"""Return local CPE.""" """Return local CPE."""
return self._data.get('OperatingSystemCPEName', UNKNOWN) return self._data.get('OperatingSystemCPEName', UNKNOWN)
def _check_dbus_hostname(self):
"""Check if systemd is connect or raise error."""
if not self.sys_dbus.hostname.is_connected:
_LOGGER.error("No hostname dbus connection available")
raise HostNotSupportedError()
async def update(self): async def update(self):
"""Update properties over dbus.""" """Update properties over dbus."""
self._check_dbus_hostname()
_LOGGER.info("Update local host information") _LOGGER.info("Update local host information")
try: try:
self._data = await self.sys_dbus.hostname.get_properties() self._data = await self.sys_dbus.hostname.get_properties()