def got_error(self, error):
"""Called by DBus when the state is retrieved from NM."""
if isinstance(error, self.dbus.exceptions.DBusException) and \ error.get_dbus_name() == DBUS_UNKNOWN_SERVICE: logger.debug("Network Manager not present")
# Assuming since Network Manager is not installed,
# the user has connected in some other way self.call_result_cb(ONLINE)
else: logger.error("Error contacting NetworkManager: %s" % str(error)) self.call_result_cb(UNKNOWN)
This code assumes that the only case we get error from network manager is when it is not running.
However, if we don't satisfy "at_console" policy condition (e.g. logging in from SSH) then SD will receive an error which is not DBUS_UNKNOWN_SERVICE. How about setting ONLINE state on any error?
def got_error(self, error): exceptions. DBusException) and \
error. get_dbus_ name() == DBUS_UNKNOWN_ SERVICE:
logger. debug(" Network Manager not present")
self. call_result_ cb(ONLINE)
logger. error(" Error contacting NetworkManager: %s" %
str(error) )
self. call_result_ cb(UNKNOWN)
"""Called by DBus when the state is retrieved from NM."""
if isinstance(error, self.dbus.
# Assuming since Network Manager is not installed,
# the user has connected in some other way
else:
This code assumes that the only case we get error from network manager is when it is not running. SERVICE. How about setting ONLINE state on any error?
However, if we don't satisfy "at_console" policy condition (e.g. logging in from SSH) then SD will receive an error which is not DBUS_UNKNOWN_