Blame SOURCES/rootpw.patch

7d6bdc
From 44a643f4c115d638d42f19f668cef1c220aab1b6 Mon Sep 17 00:00:00 2001
7d6bdc
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
7d6bdc
Date: Thu, 17 Jan 2019 18:06:02 +0100
7d6bdc
Subject: [PATCH] Updated the code to use the up-to-date Anaconda API.
7d6bdc
7d6bdc
Fixes RHBZ#1665551
7d6bdc
---
7d6bdc
 org_fedora_oscap/gui/spokes/oscap.py | 29 +++++++++++++++++++---------
7d6bdc
 1 file changed, 20 insertions(+), 9 deletions(-)
7d6bdc
7d6bdc
diff --git a/org_fedora_oscap/gui/spokes/oscap.py b/org_fedora_oscap/gui/spokes/oscap.py
7d6bdc
index 36fd656..f16699b 100644
7d6bdc
--- a/org_fedora_oscap/gui/spokes/oscap.py
7d6bdc
+++ b/org_fedora_oscap/gui/spokes/oscap.py
7d6bdc
@@ -38,6 +38,8 @@
7d6bdc
 from pyanaconda.ui.categories.system import SystemCategory
7d6bdc
 from pykickstart.errors import KickstartValueError
7d6bdc
 
7d6bdc
+from pyanaconda.modules.common.constants.services import USERS
7d6bdc
+
7d6bdc
 # pylint: disable-msg=E0611
7d6bdc
 from gi.repository import Gdk
7d6bdc
 
7d6bdc
@@ -650,26 +652,35 @@ def _update_message_store(self, report_only=False):
7d6bdc
 
7d6bdc
     def _resolve_rootpw_issues(self, messages, report_only):
7d6bdc
         """Mitigate root password issues (which are not fatal in GUI)"""
7d6bdc
-        fatal_rootpw_msgs = [msg for msg in messages
7d6bdc
-                             if msg.origin == rule_handling.PasswdRules and msg.type == common.MESSAGE_TYPE_FATAL]
7d6bdc
+        fatal_rootpw_msgs = [
7d6bdc
+            msg for msg in messages
7d6bdc
+            if msg.origin == rule_handling.PasswdRules and msg.type == common.MESSAGE_TYPE_FATAL]
7d6bdc
+
7d6bdc
         if fatal_rootpw_msgs:
7d6bdc
             for msg in fatal_rootpw_msgs:
7d6bdc
                 # cannot just change the message type because it is a namedtuple
7d6bdc
                 messages.remove(msg)
7d6bdc
-                messages.append(common.RuleMessage(self.__class__,
7d6bdc
-                                                   common.MESSAGE_TYPE_WARNING,
7d6bdc
-                                                   msg.text))
7d6bdc
+
7d6bdc
+                msg = common.RuleMessage(
7d6bdc
+                    self.__class__, common.MESSAGE_TYPE_WARNING, msg.text)
7d6bdc
+                messages.append(msg)
7d6bdc
+
7d6bdc
             if not report_only:
7d6bdc
-                self.__old_root_pw = self.data.rootpw.password
7d6bdc
+                users_proxy = USERS.get_proxy()
7d6bdc
+
7d6bdc
+                self.__old_root_pw = users_proxy.RootPassword
7d6bdc
                 self.data.rootpw.password = None
7d6bdc
-                self.__old_root_pw_seen = self.data.rootpw.seen
7d6bdc
+                self.__old_root_pw_seen = users_proxy.IsRootpwKickstarted
7d6bdc
                 self.data.rootpw.seen = False
7d6bdc
 
7d6bdc
     def _revert_rootpw_changes(self):
7d6bdc
         if self.__old_root_pw is not None:
7d6bdc
-            self.data.rootpw.password = self.__old_root_pw
7d6bdc
-            self.data.rootpw.seen = self.__old_root_pw_seen
7d6bdc
+            users_proxy = USERS.get_proxy()
7d6bdc
+
7d6bdc
+            users_proxy.SetRootPassword(self.__old_root_pw)
7d6bdc
             self.__old_root_pw = None
7d6bdc
+
7d6bdc
+            users_proxy.SetRootpwKickstarted(self.__old_root_pw_seen)
7d6bdc
             self.__old_root_pw_seen = None
7d6bdc
 
7d6bdc
     @async_action_wait