43edf8
From 34e9cfc34a397d2b0e34167fe6ff7cace1c4a020 Mon Sep 17 00:00:00 2001
43edf8
From: Florence Blanc-Renaud <flo@redhat.com>
43edf8
Date: Wed, 15 Mar 2023 12:04:23 +0100
43edf8
Subject: [PATCH] server install: remove error log about missing bkup file
43edf8
43edf8
The client installer code can be called in 3 different ways:
43edf8
- from ipa-client-install CLI
43edf8
- from ipa-replica-install CLI if the client is not already installed
43edf8
- from ipa-server-install
43edf8
43edf8
In the last case, the client installer is called with
43edf8
options.on_master=True
43edf8
As a result, it's skipping the part that is creating the krb5
43edf8
configuration:
43edf8
    if not options.on_master:
43edf8
        nolog = tuple()
43edf8
        configure_krb5_conf(...)
43edf8
43edf8
The configure_krb5_conf method is the place where the krb5.conf file is
43edf8
backup'ed with the extention ".ipabkp". For a master installation, this
43edf8
code is not called and the ipabkp file does not exist => delete raises
43edf8
an error.
43edf8
43edf8
When delete fails because the file does not exist, no need to log an
43edf8
error message.
43edf8
43edf8
Fixes: https://pagure.io/freeipa/issue/9306
43edf8
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
43edf8
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
43edf8
Reviewed-By: Stanislav Levin <slev@altlinux.org>
43edf8
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
43edf8
---
43edf8
 ipaclient/install/client.py | 7 +++----
43edf8
 1 file changed, 3 insertions(+), 4 deletions(-)
43edf8
43edf8
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
43edf8
index fed649065c94d2f2623157b825b374b850a4a03e..6fcb97641b7a9367aa32ff0401653a0e34b12073 100644
43edf8
--- a/ipaclient/install/client.py
43edf8
+++ b/ipaclient/install/client.py
43edf8
@@ -116,10 +116,9 @@ def cleanup(func):
43edf8
             os.rmdir(ccache_dir)
43edf8
         except OSError:
43edf8
             pass
43edf8
-        try:
43edf8
-            os.remove(krb_name + ".ipabkp")
43edf8
-        except OSError:
43edf8
-            logger.error("Could not remove %s.ipabkp", krb_name)
43edf8
+        # During master installation, the .ipabkp file is not created
43edf8
+        # Ignore the delete error if it is "file does not exist"
43edf8
+        remove_file(krb_name + ".ipabkp")
43edf8
 
43edf8
     return inner
43edf8
 
43edf8
-- 
43edf8
2.39.2
43edf8