Do not restore SELinux settings that were not backed up

https://fedorahosted.org/freeipa/ticket/4678

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Petr Viktorin 2014-11-18 10:40:31 +01:00 committed by Petr Vobornik
parent 52b141ca6a
commit a14ce85357
2 changed files with 4 additions and 1 deletions

View File

@ -152,7 +152,8 @@ class BaseTaskNamespace(object):
:param required_settings: A dictionary mapping the boolean names
to desired_values.
The desired value can be 'on' or 'off'.
The desired value can be 'on' or 'off',
or None to leave the setting unchanged.
:param backup_func: A function called for each boolean with two
arguments: the name and the previous value

View File

@ -363,6 +363,8 @@ class RedHatTaskNamespace(BaseTaskNamespace):
updated_vars = {}
failed_vars = {}
for setting, state in required_settings.iteritems():
if state is None:
continue
try:
(stdout, stderr, rc) = ipautil.run([paths.GETSEBOOL, setting])
original_state = stdout.split()[2]