1
0
Fork 0

Support chassis type matching in recommend.conf

Resolves: rhbz#1565598

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
This commit is contained in:
Ondřej Lysoněk 2018-08-07 17:07:49 +02:00
parent ec52b52a40
commit 469a862501
3 changed files with 13 additions and 1 deletions

View file

@ -212,6 +212,8 @@ test:
$(PYTHON) -m unittest discover tests
lint:
$(PYLINT) -E -f parseable tuned *.py
# --ignore commands.py is a workaround for
# https://bugzilla.redhat.com/show_bug.cgi?id=1613466
$(PYLINT) --ignore commands.py -E -f parseable tuned *.py
.PHONY: clean archive srpm tag test lint

View file

@ -57,8 +57,10 @@ Requires: %{_py}-schedutils, %{_py}-linux-procfs, %{_py}-perf
# requires for packages with inconsistent python2/3 names
%if %{with python3}
Requires: python3-dbus, python3-gobject-base
Requires: python3-dmidecode
%else
Requires: dbus-python, pygobject3-base
Requires: python-dmidecode
%endif
Requires: virt-what, ethtool, gawk, hdparm
Requires: util-linux, dbus, polkit

View file

@ -9,6 +9,7 @@ import re
import procfs
from subprocess import *
from tuned.exceptions import TunedException
import dmidecode
log = tuned.logs.get()
@ -413,6 +414,13 @@ class commands:
ps.reload_threads()
if len(ps.find_by_regex(re.compile(value))) == 0:
match = False
elif option == "chassis_type":
for chassis in dmidecode.chassis().values():
chassis_type = chassis["data"]["Type"]
if re.match(value, chassis_type, re.IGNORECASE):
break
else:
match = False
if match:
# remove the ",.*" suffix
r = re.compile(r",[^,]*$")