oscap-anaconda-addon/SOURCES/rootpw.patch

69 lines
2.8 KiB
Diff
Raw Normal View History

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