From d5e1657a840ba395e21eb175e97a105cffba7bc1 Mon Sep 17 00:00:00 2001 From: Jan Vcelak Date: Tue, 9 Oct 2012 16:43:25 +0200 Subject: [PATCH] plugins: do not crash if devices are not specified --- tuned/plugins/base.py | 6 ++++-- tuned/plugins/plugin_script.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tuned/plugins/base.py b/tuned/plugins/base.py index b12634e..3001cae 100644 --- a/tuned/plugins/base.py +++ b/tuned/plugins/base.py @@ -110,7 +110,8 @@ class Plugin(object): command["set"](new_value) return - assert self._devices is not None + if self._devices is None: + return for device in self._devices: current_value = command["get"](device) @@ -131,7 +132,8 @@ class Plugin(object): self._storage.unset(storage_key) return - assert self._devices is not None + if self._devices is None: + return for device in self._devices: storage_key = self._storage_key(command_name, device) diff --git a/tuned/plugins/plugin_script.py b/tuned/plugins/plugin_script.py index ce481a5..5ff44fe 100644 --- a/tuned/plugins/plugin_script.py +++ b/tuned/plugins/plugin_script.py @@ -1,7 +1,7 @@ import base import tuned.logs import os -from subprocess import Popen +from subprocess import Popen, PIPE log = tuned.logs.get()