summaryrefslogtreecommitdiffstats
path: root/base/common/python
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2017-03-16 06:22:09 +0100
committerEndi S. Dewata <edewata@redhat.com>2017-03-16 22:58:50 +0100
commit51b72a348f61544a98850fcd7e5341322b899d3b (patch)
tree81c410c035b3728fdecde2bd5fcdbf5d221fb807 /base/common/python
parent6b9fc4b77fbd9ce3c8b1ed72bbc78aab7e28c0de (diff)
downloadpki-51b72a348f61544a98850fcd7e5341322b899d3b.tar.gz
pki-51b72a348f61544a98850fcd7e5341322b899d3b.tar.xz
pki-51b72a348f61544a98850fcd7e5341322b899d3b.zip
Exporting environment variables for PKI client.
The default pki.conf has been modified to export the environment variables such that they can be used by PKI client.
Diffstat (limited to 'base/common/python')
-rw-r--r--base/common/python/pki/cli/main.py26
1 files changed, 5 insertions, 21 deletions
diff --git a/base/common/python/pki/cli/main.py b/base/common/python/pki/cli/main.py
index 53e1b893a..268547bfc 100644
--- a/base/common/python/pki/cli/main.py
+++ b/base/common/python/pki/cli/main.py
@@ -21,6 +21,7 @@
from __future__ import absolute_import
from __future__ import print_function
+import os
import shlex
import subprocess
import sys
@@ -70,23 +71,9 @@ class PKICLI(pki.cli.CLI):
def execute_java(self, args, stdout=sys.stdout):
- # read Java home
- value = subprocess.check_output(
- '. /usr/share/pki/etc/pki.conf && . /etc/pki/pki.conf && echo $JAVA_HOME',
- shell=True)
- java_home = value.decode(sys.getfilesystemencoding()).strip()
-
- # read PKI library
- value = subprocess.check_output(
- '. /usr/share/pki/etc/pki.conf && . /etc/pki/pki.conf && echo $PKI_LIB',
- shell=True)
- pki_lib = value.decode(sys.getfilesystemencoding()).strip()
-
- # read logging configuration path
- value = subprocess.check_output(
- '. /usr/share/pki/etc/pki.conf && . /etc/pki/pki.conf && echo $LOGGING_CONFIG',
- shell=True)
- logging_config = value.decode(sys.getfilesystemencoding()).strip()
+ java_home = os.getenv('JAVA_HOME')
+ pki_lib = os.getenv('PKI_LIB')
+ logging_config = os.getenv('LOGGING_CONFIG')
cmd = [
java_home + '/bin/java',
@@ -122,10 +109,7 @@ class PKICLI(pki.cli.CLI):
def execute(self, argv):
# append global options
- value = subprocess.check_output(
- '. /usr/share/pki/etc/pki.conf && . /etc/pki/pki.conf && echo $PKI_CLI_OPTIONS',
- shell=True)
- value = value.decode(sys.getfilesystemencoding()).strip()
+ value = os.getenv('PKI_CLI_OPTIONS')
args = shlex.split(value)
args.extend(argv[1:])