From 169f9abb6b9fdc11dc5d3e4ec8e6e9c3ef4dfd4f Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Sep 15 2023 11:53:12 +0000 Subject: Don't assume KRB5CCNAME is in the environment in replica install The replica install was unilaterally removing KRB5CCNAME from os.environ in some cases. Instead check first to see if it is present and only remove in that case. Fixes: https://pagure.io/freeipa/issue/9446 Signed-off-by: Rob Crittenden Reviewed-By: Florence Blanc-Renaud Reviewed-By: Alexander Bokovoy Reviewed-By: Florence Blanc-Renaud --- diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py index ba5c917..27fbdef 100644 --- a/ipaserver/install/server/replicainstall.py +++ b/ipaserver/install/server/replicainstall.py @@ -1002,7 +1002,7 @@ def promote_check(installer): raise errors.ACIError(info="Not authorized") if installer._ccache is None: - del os.environ['KRB5CCNAME'] + os.environ.pop('KRB5CCNAME', None) else: os.environ['KRB5CCNAME'] = installer._ccache @@ -1211,7 +1211,7 @@ def promote_check(installer): if add_to_ipaservers: # use user's credentials when the server host is not ipaservers if installer._ccache is None: - del os.environ['KRB5CCNAME'] + os.environ.pop('KRB5CCNAME', None) else: os.environ['KRB5CCNAME'] = installer._ccache