From d2557284f7323a82724dd04bc0ed6cef3e33f4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Mon, 16 Oct 2017 17:44:45 +0200 Subject: [PATCH] Expand variables in the 'devices' option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Variables in the 'devices' option were not being expanded. This is bad. It shows that the current variable expansion system is broken. We need to come up with a consistent, well-defined way of expanding variables. Preferably it should be done all in one place. The expansion is probably still not done for options 'type', 'enabled', 'replace', 'devices_udev_regex', 'script_pre' and 'script_post'. Let's deal with that later, as we don't need it in our profiles right now. Related: rhbz#1490399 Signed-off-by: Ondřej Lysoněk --- tuned/profiles/loader.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tuned/profiles/loader.py b/tuned/profiles/loader.py index 0c7520c..9c7db2b 100644 --- a/tuned/profiles/loader.py +++ b/tuned/profiles/loader.py @@ -60,8 +60,14 @@ class Loader(object): if "variables" in final_profile.units: self._variables.add_from_cfg(final_profile.units["variables"].options) del(final_profile.units["variables"]) + # FIXME hack, do all variable expansions in one place + self._expand_vars_in_devices(final_profile) return final_profile + def _expand_vars_in_devices(self, profile): + for unit in profile.units: + profile.units[unit].devices = self._variables.expand(profile.units[unit].devices) + def _load_profile(self, profile_names, profiles, processed_files): for name in profile_names: filename = self._profile_locator.get_config(name, processed_files)