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