def _call(self, method_name, *args, **kwargs):
        try:
            self._init_proxy()
        except dbus.exceptions.DBusException:
            raise TunedAdminDBusException(
                "Cannot talk to Tuned daemon via DBus. Is Tuned daemon running?"
            )

        try:
            method = self._proxy.get_dbus_method(method_name)
            return method(*args, **kwargs)
        except dbus.exceptions.DBusException as dbus_exception:
            err_str = "DBus call to Tuned daemon failed"
            if self._debug:
                err_str += " (%s)" % str(dbus_exception)
            raise TunedAdminDBusException(err_str)
Пример #2
0
	def _init_proxy(self):
		try:
			if self._proxy is None:
				DBusGMainLoop(set_as_default=True)
				self._main_loop = GLib.MainLoop()
				bus = dbus.SystemBus()
				self._proxy = bus.get_object(self._bus_name, self._object_name)
				self._interface = dbus.Interface(self._proxy, dbus_interface = self._interface_name)
		except dbus.exceptions.DBusException:
			raise TunedAdminDBusException("Cannot talk to Tuned daemon via DBus. Is Tuned daemon running?")
Пример #3
0
    def _call(self, method_name, *args, **kwargs):
        self._init_proxy()

        try:
            method = self._interface.get_dbus_method(method_name)
            return method(*args, **kwargs)
        except dbus.exceptions.DBusException as dbus_exception:
            err_str = "DBus call to Tuned daemon failed"
            if self._debug:
                err_str += " (%s)" % str(dbus_exception)
            raise TunedAdminDBusException(err_str)