86baa9
From e3c8a9b78f01e268a907bc97ad2914bf0d1236fc Mon Sep 17 00:00:00 2001
86baa9
From: Florence Blanc-Renaud <flo@redhat.com>
86baa9
Date: Mon, 1 Apr 2019 11:10:26 +0200
86baa9
Subject: [PATCH] ipa-server-upgrade: fix add_systemd_user_hbac
86baa9
86baa9
During upgrade, the method add_systemd_user_hbac is creating
86baa9
a hbacsvc and a hbacrule, but fails in python2 because of
86baa9
unicode conversion errors.
86baa9
The arguments should be defined as u'value'.
86baa9
86baa9
Fixes: https://pagure.io/freeipa/issue/7896
86baa9
Reviewed-By: Christian Heimes <cheimes@redhat.com>
86baa9
---
86baa9
 ipaserver/install/server/upgrade.py | 12 ++++++------
86baa9
 1 file changed, 6 insertions(+), 6 deletions(-)
86baa9
86baa9
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
86baa9
index f4389d37909fc0b5aed960638de67243906b634d..ba0dfa423a3fc9560ef3c81c1d98cad39c320575 100644
86baa9
--- a/ipaserver/install/server/upgrade.py
86baa9
+++ b/ipaserver/install/server/upgrade.py
86baa9
@@ -1689,12 +1689,12 @@ def update_replica_config(db_suffix):
86baa9
 
86baa9
 def add_systemd_user_hbac():
86baa9
     logger.info('[Create systemd-user hbac service and rule]')
86baa9
-    rule = 'allow_systemd-user'
86baa9
-    service = 'systemd-user'
86baa9
+    rule = u'allow_systemd-user'
86baa9
+    service = u'systemd-user'
86baa9
     try:
86baa9
         api.Command.hbacsvc_add(
86baa9
             service,
86baa9
-            description='pam_systemd and systemd user@.service'
86baa9
+            description=u'pam_systemd and systemd user@.service'
86baa9
         )
86baa9
     except ipalib.errors.DuplicateEntry:
86baa9
         logger.info('hbac service %s already exists', service)
86baa9
@@ -1707,10 +1707,10 @@ def add_systemd_user_hbac():
86baa9
     try:
86baa9
         api.Command.hbacrule_add(
86baa9
             rule,
86baa9
-            description=('Allow pam_systemd to run user@.service to create '
86baa9
+            description=(u'Allow pam_systemd to run user@.service to create '
86baa9
                          'a system user session'),
86baa9
-            usercategory='all',
86baa9
-            hostcategory='all',
86baa9
+            usercategory=u'all',
86baa9
+            hostcategory=u'all',
86baa9
         )
86baa9
     except ipalib.errors.DuplicateEntry:
86baa9
         logger.info('hbac rule %s already exists', rule)
86baa9
-- 
86baa9
2.20.1
86baa9