From f8cb1e97ad0ac7431c221823e39d3fc026029e0f Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Wed, 9 May 2012 10:23:02 +0200 Subject: [PATCH] Fixed active_profile + fixed exception handling in switch_profile --- tuned/controller.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tuned/controller.py b/tuned/controller.py index 0a78c01..023f98a 100644 --- a/tuned/controller.py +++ b/tuned/controller.py @@ -117,16 +117,21 @@ class Controller(exports.interfaces.ExportableInterface): try: self.config_file = profiles except ValueError as e: - log.error("Unable to open profile's config file %s" % (cfg) ) + log.error("Unable to open profile's config file: %s" % (str(e)) ) return False return self.reload() - @exports.export("", "s") + @exports.export("", "as") def active_profile(self): - if self.config_file.startswith("/usr/lib/tuned/"): - return self.config_file.split("/")[-2] - return self.config_file + profiles = [] + for cfg in self.config_file: + try: + profiles.append(cfg.split('/')[-2]) + except IndexError: + profiles.append(cfg) + + return profiles @exports.export("", "b") def status(self):