summaryrefslogtreecommitdiffstats
path: root/base/server/python/pki/server/deployment/pkiparser.py
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2013-09-19 14:04:06 -0400
committerAde Lee <alee@redhat.com>2013-09-20 11:53:43 -0400
commit4c17e821a99318a1cf62ca0862ce9ee404ea5f6a (patch)
tree4369a4053d1f6d67c27e826ba8e6b567977003a2 /base/server/python/pki/server/deployment/pkiparser.py
parentfb32217fe98603dbe20563ce9836eb86813ebc98 (diff)
downloadpki-4c17e821a99318a1cf62ca0862ce9ee404ea5f6a.tar.gz
pki-4c17e821a99318a1cf62ca0862ce9ee404ea5f6a.tar.xz
pki-4c17e821a99318a1cf62ca0862ce9ee404ea5f6a.zip
Added interactive install for tomcat TPS
Up to now, only pkispawn with a config file worked for tomcat-tps installation. This patch adds the functionality for the interactive installation.
Diffstat (limited to 'base/server/python/pki/server/deployment/pkiparser.py')
-rw-r--r--base/server/python/pki/server/deployment/pkiparser.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/base/server/python/pki/server/deployment/pkiparser.py b/base/server/python/pki/server/deployment/pkiparser.py
index e7b23a6d3..523d79e78 100644
--- a/base/server/python/pki/server/deployment/pkiparser.py
+++ b/base/server/python/pki/server/deployment/pkiparser.py
@@ -30,6 +30,8 @@ import random
import requests
import string
import subprocess
+import xml.etree.ElementTree as ET
+from urlparse import urlparse
# PKI Imports
import pki
@@ -85,6 +87,7 @@ class PKIConfigParser:
self.indent = 0
self.ds_connection = None
self.sd_connection = None
+ self.authdb_connection = None
# Master and Slot dictionaries
self.pki_master_dict = dict()
@@ -431,6 +434,45 @@ class PKIConfigParser:
else:
raise
+ def authdb_connect(self):
+
+ hostname = self.pki_master_dict['pki_authdb_hostname']
+ port = self.pki_master_dict['pki_authdb_port']
+
+ if config.str2bool(self.pki_master_dict['pki_authdb_secure_conn']):
+ protocol = 'ldaps'
+ else:
+ protocol = 'ldap'
+
+ self.authdb_connection = ldap.initialize(protocol + '://' + hostname + ':' + port)
+ self.authdb_connection.search_s('', ldap.SCOPE_BASE)
+
+ def authdb_base_dn_exists(self):
+ try:
+ results = self.authdb_connection.search_s(
+ self.pki_master_dict['pki_authdb_basedn'],
+ ldap.SCOPE_BASE)
+
+ if results is None or len(results) == 0:
+ return False
+
+ return True
+
+ except ldap.NO_SUCH_OBJECT:
+ return False
+
+ def get_server_status(self, system_type, system_uri):
+ parse = urlparse(self.pki_master_dict[system_uri])
+ conn = pki.client.PKIConnection(
+ protocol=parse.scheme,
+ hostname=parse.hostname,
+ port=str(parse.port),
+ subsystem=system_type)
+ client = pki.system.SystemStatusClient(conn)
+ response = client.getStatus()
+ root = ET.fromstring(response)
+ return root.findtext("Status")
+
def compose_pki_master_dictionary(self):
"Create a single master PKI dictionary from the sectional dictionaries"
try: