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

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