summaryrefslogtreecommitdiffstats
path: root/base/server/python/pki/server/deployment/pkiparser.py
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2015-08-16 19:00:00 +0200
committerChristian Heimes <cheimes@redhat.com>2015-08-17 21:14:12 +0200
commit0ab2ba73018675187ed932dc0b421488af17600a (patch)
tree8cef2fc045bcdbca93c947ec7ed0bdc088e478be /base/server/python/pki/server/deployment/pkiparser.py
parent74a355185eeb30e7d42ff2d29c4c3c3c298b2a12 (diff)
downloadpki-0ab2ba73018675187ed932dc0b421488af17600a.tar.gz
pki-0ab2ba73018675187ed932dc0b421488af17600a.tar.xz
pki-0ab2ba73018675187ed932dc0b421488af17600a.zip
Py3 compatibility: encode output of subprocess call
In Python 3 subprocess.Popen() and check_out() return bytes. The rest of PKI expects text, so the output has to be decoded. - ascii for dnsdomainname - sys.getfilesystemencoding() for paths - utf-8 for the rest
Diffstat (limited to 'base/server/python/pki/server/deployment/pkiparser.py')
-rw-r--r--base/server/python/pki/server/deployment/pkiparser.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/base/server/python/pki/server/deployment/pkiparser.py b/base/server/python/pki/server/deployment/pkiparser.py
index 6eeb74346..1905734f3 100644
--- a/base/server/python/pki/server/deployment/pkiparser.py
+++ b/base/server/python/pki/server/deployment/pkiparser.py
@@ -31,6 +31,7 @@ import random
import requests.exceptions
import string
import subprocess
+import sys
import xml.etree.ElementTree as ET
from six.moves import input, range # pylint: disable=W0622,F0401
@@ -174,16 +175,18 @@ class PKIConfigParser:
resteasy_lib = subprocess.check_output(
'. /etc/pki/pki.conf && echo $RESTEASY_LIB',
shell=True)
+ resteasy_lib = resteasy_lib.decode(sys.getfilesystemencoding())
# workaround for pylint error E1103
- resteasy_lib = str(resteasy_lib).strip()
+ resteasy_lib = resteasy_lib.strip()
# JNI jar location
jni_jar_dir = subprocess.check_output(
'. /usr/share/pki/etc/pki.conf && . /etc/pki/pki.conf '
'&& echo $JNI_JAR_DIR',
shell=True)
+ jni_jar_dir = jni_jar_dir.decode(sys.getfilesystemencoding())
# workaround for pylint error E1103
- jni_jar_dir = str(jni_jar_dir).strip()
+ jni_jar_dir = jni_jar_dir.strip()
default_instance_name = 'pki-tomcat'
default_http_port = '8080'