ac7d03
From dd300d7db884db2d0aa228c08d2447539ce14c1c Mon Sep 17 00:00:00 2001
ac7d03
From: Martin Babinsky <mbabinsk@redhat.com>
ac7d03
Date: Wed, 22 Mar 2017 16:52:14 +0100
ac7d03
Subject: [PATCH] Remove duplicate functionality in upgrade
ac7d03
ac7d03
Since krbinstance code can now handle all operations of the
ac7d03
`enabled_anonymous_principal` function from upgrade we can remove
ac7d03
extraneous function altogether.
ac7d03
ac7d03
https://pagure.io/freeipa/issue/6799
ac7d03
ac7d03
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
ac7d03
---
ac7d03
 ipaserver/install/server/upgrade.py | 16 +---------------
ac7d03
 1 file changed, 1 insertion(+), 15 deletions(-)
ac7d03
ac7d03
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
ac7d03
index 0db764cb80f6d0fb22f00719dadf1f921f97bf62..25b86297af3ae9d5f21cebb93f493b90670dcfc3 100644
ac7d03
--- a/ipaserver/install/server/upgrade.py
ac7d03
+++ b/ipaserver/install/server/upgrade.py
ac7d03
@@ -1482,20 +1482,6 @@ def add_default_caacl(ca):
ac7d03
     sysupgrade.set_upgrade_state('caacl', 'add_default_caacl', True)
ac7d03
 
ac7d03
 
ac7d03
-def enable_anonymous_principal(krb):
ac7d03
-    princ_realm = krb.get_anonymous_principal_name()
ac7d03
-    dn = DN(('krbprincipalname', princ_realm), krb.get_realm_suffix())
ac7d03
-    try:
ac7d03
-        _ = api.Backend.ldap2.get_entry(dn)  # pylint: disable=unused-variable
ac7d03
-    except ipalib.errors.NotFound:
ac7d03
-        krb.add_anonymous_principal()
ac7d03
-
ac7d03
-    try:
ac7d03
-        api.Backend.ldap2.set_entry_active(dn, True)
ac7d03
-    except ipalib.errors.AlreadyActive:
ac7d03
-        pass
ac7d03
-
ac7d03
-
ac7d03
 def setup_pkinit(krb):
ac7d03
     root_logger.info("[Setup PKINIT]")
ac7d03
 
ac7d03
@@ -1809,7 +1795,7 @@ def upgrade_configuration():
ac7d03
                         KDC_CERT=paths.KDC_CERT,
ac7d03
                         KDC_KEY=paths.KDC_KEY,
ac7d03
                         CACERT_PEM=paths.CACERT_PEM)
ac7d03
-    enable_anonymous_principal(krb)
ac7d03
+    krb.add_anonymous_principal()
ac7d03
     http.request_anon_keytab()
ac7d03
     setup_pkinit(krb)
ac7d03
 
ac7d03
-- 
ac7d03
2.12.2
ac7d03