URL: https://github.com/freeipa/freeipa/pull/997
Author: stlaz
 Title: #997: Uninstall: fix BytesWarning exception
Action: opened

PR body:
"""
When uninstalling, if server does not have all roles, exception
is thrown as the role is not found. `member_principal` variable
has to be string here, otherwise we're using str on bytes.

https://pagure.io/freeipa/issue/4985
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/997/head:pr997
git checkout pr997
From 10da139e725420f76d4b904c7f2ab28e158933f5 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Wed, 23 Aug 2017 15:26:18 +0200
Subject: [PATCH] Uninstall: fix BytesWarning exception

When uninstalling, if server does not have all roles, exception
is thrown as the role is not found. `member_principal` variable
has to be string here, otherwise we're using str on bytes.

https://pagure.io/freeipa/issue/4985
---
 ipaserver/plugins/server.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ipaserver/plugins/server.py b/ipaserver/plugins/server.py
index 780c5b3e1b..2cee976f29 100644
--- a/ipaserver/plugins/server.py
+++ b/ipaserver/plugins/server.py
@@ -581,14 +581,15 @@ def _remove_server_principal_references(self, master):
             except (ldap.NO_SUCH_OBJECT, ldap.NO_SUCH_ATTRIBUTE):
                 logger.debug(
                     "Replica (%s) memberPrincipal (%s) not found in %s",
-                    master, member_principal, dn)
+                    master, member_principal.decode('utf-8'), dn)
             except Exception as e:
                 self.add_message(
                     messages.ServerRemovalWarning(
                         message=_("Failed to clean memberPrincipal "
                                   "%(principal)s from s4u2proxy entry %(dn)s: "
                                   "%(err)s") % dict(
-                                      principal=member_principal,
+                                      principal=(member_principal
+                                                 .decode('utf-8')),
                                       dn=dn, err=e)))
 
         try:
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to