e3ffab
From 449e333dbf4c803bb179e7d27f08666fd6e333af Mon Sep 17 00:00:00 2001
e3ffab
From: Petr Viktorin <pviktori@redhat.com>
e3ffab
Date: Tue, 18 Nov 2014 10:40:31 +0100
e3ffab
Subject: [PATCH] Do not restore SELinux settings that were not backed up
e3ffab
e3ffab
https://fedorahosted.org/freeipa/ticket/4678
e3ffab
e3ffab
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
e3ffab
---
e3ffab
 ipaplatform/base/tasks.py   | 3 ++-
e3ffab
 ipaplatform/redhat/tasks.py | 2 ++
e3ffab
 2 files changed, 4 insertions(+), 1 deletion(-)
e3ffab
e3ffab
diff --git a/ipaplatform/base/tasks.py b/ipaplatform/base/tasks.py
e3ffab
index a6684d7653d6de8202a489edb1f7a38f4b344bbc..ab2c50332bce9f6eb95e2cb76aa6f7904b542765 100644
e3ffab
--- a/ipaplatform/base/tasks.py
e3ffab
+++ b/ipaplatform/base/tasks.py
e3ffab
@@ -146,7 +146,8 @@ class BaseTaskNamespace(object):
e3ffab
 
e3ffab
         :param required_settings: A dictionary mapping the boolean names
e3ffab
                                   to desired_values.
e3ffab
-                                  The desired value can be 'on' or 'off'.
e3ffab
+                                  The desired value can be 'on' or 'off',
e3ffab
+                                  or None to leave the setting unchanged.
e3ffab
 
e3ffab
         :param backup_func: A function called for each boolean with two
e3ffab
                             arguments: the name and the previous value
e3ffab
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
e3ffab
index 4977e1c7c496e36d56110bcdf040ab5c932d31a2..c01d8cf8b65b3d93ba204b3453f5c65d556723cf 100644
e3ffab
--- a/ipaplatform/redhat/tasks.py
e3ffab
+++ b/ipaplatform/redhat/tasks.py
e3ffab
@@ -366,6 +366,8 @@ class RedHatTaskNamespace(BaseTaskNamespace):
e3ffab
         updated_vars = {}
e3ffab
         failed_vars = {}
e3ffab
         for setting, state in required_settings.iteritems():
e3ffab
+            if state is None:
e3ffab
+                continue
e3ffab
             try:
e3ffab
                 (stdout, stderr, rc) = ipautil.run([paths.GETSEBOOL, setting])
e3ffab
                 original_state = stdout.split()[2]
e3ffab
-- 
e3ffab
2.1.0
e3ffab