From 2275777fe0301bbfb20c8637dd803aa23a22169f Mon Sep 17 00:00:00 2001 From: Jan Vcelak Date: Mon, 8 Oct 2012 14:24:53 +0200 Subject: [PATCH] tuned.controller: fix profile switching code --- tuned/controller.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tuned/controller.py b/tuned/controller.py index c2f385b..3ee56b1 100644 --- a/tuned/controller.py +++ b/tuned/controller.py @@ -85,16 +85,13 @@ class Controller(exports.interfaces.ExportableInterface): return self.stop() and self.start() @exports.export("s", "b") - def switch_profile(self, profile): - for i in range(len(profiles)): - profiles[i] = profile.Profile.find_profile(profiles[i]) - try: - self.config_file = profiles - except ValueError as e: - log.error("Unable to open profile's config file: %s" % e) - return False + def switch_profile(self, profile_name): + was_running = self._daemon.is_running() + if was_running: self._daemon.stop() + self._daemon.set_profile(profile_name) + if was_running: self._daemon.start() - return self.reload() + return True @exports.export("", "s") def active_profile(self):