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