Blame SOURCES/rootpw.patch

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