Blame SOURCES/0004-server-install-remove-error-log-about-missing-bkup-file_rhbz#2160389.patch

711f45
From 6f50b00953c0000d6da8db0f5e8974ae33d7b5d5 Mon Sep 17 00:00:00 2001
711f45
From: Florence Blanc-Renaud <flo@redhat.com>
711f45
Date: Jan 16 2023 07:44:50 +0000
711f45
Subject: server install: remove error log about missing bkup file
711f45
711f45
711f45
The client installer code can be called in 3 different ways:
711f45
- from ipa-client-install CLI
711f45
- from ipa-replica-install CLI if the client is not already installed
711f45
- from ipa-server-install
711f45
711f45
In the last case, the client installer is called with
711f45
options.on_master=True
711f45
As a result, it's skipping the part that is creating the krb5
711f45
configuration:
711f45
    if not options.on_master:
711f45
        nolog = tuple()
711f45
        configure_krb5_conf(...)
711f45
711f45
The configure_krb5_conf method is the place where the krb5.conf file is
711f45
backup'ed with the extention ".ipabkp". For a master installation, this
711f45
code is not called and the ipabkp file does not exist => delete raises
711f45
an error.
711f45
711f45
When delete fails because the file does not exist, no need to log an
711f45
error message.
711f45
711f45
Fixes: https://pagure.io/freeipa/issue/9306
711f45
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
711f45
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
711f45
711f45
---
711f45
711f45
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
711f45
index e5d3e82..6e7f17d 100644
711f45
--- a/ipaclient/install/client.py
711f45
+++ b/ipaclient/install/client.py
711f45
@@ -124,10 +124,9 @@ def cleanup(func):
711f45
             os.rmdir(ccache_dir)
711f45
         except OSError:
711f45
             pass
711f45
-        try:
711f45
-            os.remove(krb_name + ".ipabkp")
711f45
-        except OSError:
711f45
-            logger.error("Could not remove %s.ipabkp", krb_name)
711f45
+        # During master installation, the .ipabkp file is not created
711f45
+        # Ignore the delete error if it is "file does not exist"
711f45
+        remove_file(krb_name + ".ipabkp")
711f45
 
711f45
     return inner
711f45
 
711f45