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