95ea96
From 7f6f620ec43b5606413524d25d3cae1003930f55 Mon Sep 17 00:00:00 2001
95ea96
From: Florence Blanc-Renaud <flo@redhat.com>
95ea96
Date: Fri, 6 Jul 2018 12:47:34 +0200
95ea96
Subject: [PATCH] ipa client uninstall: clean the state store when restoring
95ea96
 hostname
95ea96
95ea96
When ipa client was installed with the --hostname= option, it stores
95ea96
[network]
95ea96
hostname = (current hostname)
95ea96
in /var/lib/ipa-client/sysrestore/sysrestore.state and changes the hostname
95ea96
from (current hostname) to the value provided in --hostname.
95ea96
95ea96
During uninstall, the previous hostname is restored but the entry does
95ea96
not get removed from sysrestore.state. As the uninstaller checks if all
95ea96
entries from sysrestore.state have been restored, it warns that some
95ea96
state has not been restored.
95ea96
95ea96
The fix calls statestore.restore_state() instead of statestore.get_state()
95ea96
as this method also clears the entry.
95ea96
95ea96
https://pagure.io/freeipa/issue/7620
95ea96
95ea96
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
95ea96
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
95ea96
---
95ea96
 ipaplatform/redhat/tasks.py | 2 +-
95ea96
 1 file changed, 1 insertion(+), 1 deletion(-)
95ea96
95ea96
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
95ea96
index dcafd735c0161e5cd979ccb113863e7885a14ab3..6a4270defc9f444f76677bdf08d2a680649664bb 100644
95ea96
--- a/ipaplatform/redhat/tasks.py
95ea96
+++ b/ipaplatform/redhat/tasks.py
95ea96
@@ -380,7 +380,7 @@ class RedHatTaskNamespace(BaseTaskNamespace):
95ea96
         statestore.backup_state('network', 'hostname', old_hostname)
95ea96
 
95ea96
     def restore_hostname(self, fstore, statestore):
95ea96
-        old_hostname = statestore.get_state('network', 'hostname')
95ea96
+        old_hostname = statestore.restore_state('network', 'hostname')
95ea96
 
95ea96
         if old_hostname is not None:
95ea96
             try:
95ea96
-- 
95ea96
2.17.1
95ea96