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