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:
parent
ec52b52a40
commit
469a862501
3 changed files with 13 additions and 1 deletions
4
Makefile
4
Makefile
|
|
@ -212,6 +212,8 @@ test:
|
||||||
$(PYTHON) -m unittest discover tests
|
$(PYTHON) -m unittest discover tests
|
||||||
|
|
||||||
lint:
|
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
|
.PHONY: clean archive srpm tag test lint
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,10 @@ Requires: %{_py}-schedutils, %{_py}-linux-procfs, %{_py}-perf
|
||||||
# requires for packages with inconsistent python2/3 names
|
# requires for packages with inconsistent python2/3 names
|
||||||
%if %{with python3}
|
%if %{with python3}
|
||||||
Requires: python3-dbus, python3-gobject-base
|
Requires: python3-dbus, python3-gobject-base
|
||||||
|
Requires: python3-dmidecode
|
||||||
%else
|
%else
|
||||||
Requires: dbus-python, pygobject3-base
|
Requires: dbus-python, pygobject3-base
|
||||||
|
Requires: python-dmidecode
|
||||||
%endif
|
%endif
|
||||||
Requires: virt-what, ethtool, gawk, hdparm
|
Requires: virt-what, ethtool, gawk, hdparm
|
||||||
Requires: util-linux, dbus, polkit
|
Requires: util-linux, dbus, polkit
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import re
|
||||||
import procfs
|
import procfs
|
||||||
from subprocess import *
|
from subprocess import *
|
||||||
from tuned.exceptions import TunedException
|
from tuned.exceptions import TunedException
|
||||||
|
import dmidecode
|
||||||
|
|
||||||
log = tuned.logs.get()
|
log = tuned.logs.get()
|
||||||
|
|
||||||
|
|
@ -413,6 +414,13 @@ class commands:
|
||||||
ps.reload_threads()
|
ps.reload_threads()
|
||||||
if len(ps.find_by_regex(re.compile(value))) == 0:
|
if len(ps.find_by_regex(re.compile(value))) == 0:
|
||||||
match = False
|
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:
|
if match:
|
||||||
# remove the ",.*" suffix
|
# remove the ",.*" suffix
|
||||||
r = re.compile(r",[^,]*$")
|
r = re.compile(r",[^,]*$")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue