1
0
Fork 0

tuned-adm: Fix profile_info crash when no profile is active

If Tuned is running without any profile applied (e.g. after running
'tuned-adm off'), then 'tuned-adm profile_info' crashes with the
following error:

2020-06-08 17:24:11,998 ERROR    dbus.connection: Unable to set arguments (None,) according to signature 's': <class 'TypeError'>: Expected a string or unicode object
ERROR:dbus.connection:Unable to set arguments (None,) according to signature 's': <class 'TypeError'>: Expected a string or unicode object
dbus[25054]: arguments to dbus_message_get_destination() were incorrect, assertion "message != NULL" failed in file ../../dbus/dbus-message.c line 3678.
This is normally a bug in some application using the D-Bus library.

  D-Bus not built with -rdynamic so unable to print a backtrace
Aborted (core dumped)

To fix it, detect that no profile is applied and print the same
message as in _action_profile_info in this case.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
This commit is contained in:
Ondřej Lysoněk 2020-06-08 17:27:59 +02:00
parent 4eebe5f295
commit eccaf795b9

View file

@ -149,7 +149,12 @@ class Admin(object):
def _action_dbus_profile_info(self, profile = ""):
if profile == "":
profile = self._dbus_get_active_profile()
return self._controller.exit(self._print_profile_info(profile, self._controller.profile_info(profile)))
if profile:
res = self._print_profile_info(profile, self._controller.profile_info(profile))
else:
print("No current active profile.")
res = False
return self._controller.exit(res)
def _action_profile_info(self, profile = ""):
if profile == "":