URL: https://github.com/freeipa/freeipa/pull/938
Author: stlaz
 Title: #938: client: make ipa-client-install py3 compatible
Action: opened

PR body:
"""
This commit enables ipa-client-install to be installable in
Python 3 and makes it run in Python 3 by default.

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/938/head:pr938
git checkout pr938
From 92644ed215937c89e9b7ccd750b84e84a31c4c7d Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Thu, 27 Jul 2017 15:37:17 +0200
Subject: [PATCH] client: make ipa-client-install py3 compatible

This commit enables ipa-client-install to be installable in
Python 3 and makes it run in Python 3 by default.

https://pagure.io/freeipa/issue/4985
---
 freeipa.spec.in             | 1 +
 ipalib/x509.py              | 2 +-
 ipaplatform/redhat/tasks.py | 3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 44a290a294..d7c964e182 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -876,6 +876,7 @@ install/tools/ipa-dns-install
 install/tools/ipa-managed-entries
 install/tools/ipa-nis-manage
 install/tools/ipactl
+install/tools/ipa-client-install
 '
 for P in $PY3_SUBST_PATHS; do
     sed -i -e '1 s|^#!.*\bpython[^ ]*|#!%{__python3}|' $P
diff --git a/ipalib/x509.py b/ipalib/x509.py
index 7877df3288..857245aa31 100644
--- a/ipalib/x509.py
+++ b/ipalib/x509.py
@@ -61,7 +61,7 @@
 DER = 1
 
 PEM_REGEX = re.compile(
-    r'-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----',
+    b'-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----',
     re.DOTALL)
 
 EKU_SERVER_AUTH = '1.3.6.1.5.5.7.3.1'
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
index cc52c6c5f0..d98f8c1691 100644
--- a/ipaplatform/redhat/tasks.py
+++ b/ipaplatform/redhat/tasks.py
@@ -298,7 +298,8 @@ def insert_ca_certs_into_systemwide_ca_store(self, ca_certs):
                 obj += "trusted: true\n"
             elif trusted is False:
                 obj += "x-distrusted: true\n"
-            obj += "{pem}\n\n".format(pem=cert.public_bytes(x509.Encoding.PEM))
+            obj += "{pem}\n\n".format(
+                pem=cert.public_bytes(x509.Encoding.PEM).decode('ascii'))
             f.write(obj)
 
             if ext_key_usage is not None and public_key_info not in has_eku:
_______________________________________________
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