summaryrefslogtreecommitdiffstats
path: root/base/common/python/pki/system.py
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2013-03-18 11:29:52 -0400
committerAde Lee <alee@redhat.com>2013-03-21 12:11:31 -0400
commitc9a081037aa5bf15cf6226f06ea54ea98deba5bc (patch)
treeba095458c940b4db7923719ce6cf6e14a2c1da8e /base/common/python/pki/system.py
parent22d50cc526c7fd4224a4d5a0ae9ebf66afd8e83a (diff)
downloadpki-c9a081037aa5bf15cf6226f06ea54ea98deba5bc.tar.gz
pki-c9a081037aa5bf15cf6226f06ea54ea98deba5bc.tar.xz
pki-c9a081037aa5bf15cf6226f06ea54ea98deba5bc.zip
Refactor installation code to remove dependency on jython
Connection is now made to the installation servlet through a python client using JSON. The code to construct the ConfgurationRequest and parse the results has been moved to pkihelper.py, and configuration.py no longer calls a separate jython process to create the Configuration object and parse the results. The jython code has therefore been removed. Also added status servlet to other java subsystems, to be tested prior to starting configuration. Trac Ticket 532
Diffstat (limited to 'base/common/python/pki/system.py')
-rw-r--r--base/common/python/pki/system.py52
1 files changed, 51 insertions, 1 deletions
diff --git a/base/common/python/pki/system.py b/base/common/python/pki/system.py
index f49cc402e..23ad06bb2 100644
--- a/base/common/python/pki/system.py
+++ b/base/common/python/pki/system.py
@@ -19,6 +19,12 @@
# All rights reserved.
#
+import pki.encoder as encoder
+
+encoder.TYPES['ConfigurationRequest'] = ConfigurationRequest
+encoder.TYPES['ConfigurationResponse'] = ConfigurationResponse
+encoder.NOTYPES['SystemCertData'] = SystemCertData
+
class SecurityDomainInfo:
def __init__(self):
@@ -30,10 +36,54 @@ class SecurityDomainClient:
self.connection = connection
def getSecurityDomainInfo(self):
- r = self.connection.get('securityDomain/domainInfo')
+ r = self.connection.get('/rest/securityDomain/domainInfo')
j = r.json()
info = SecurityDomainInfo()
info.name = j['DomainInfo']['@id']
return info
+
+class ConfigurationRequest:
+
+ def __init__(self):
+ self.token = "Internal Key Storage Token"
+ self.isClone = "false"
+ self.secureConn = "off"
+ self.importAdminCert = "false"
+ self.generateServerCert = "true"
+
+class ConfigurationResponse:
+
+ def __init__(self):
+ pass
+
+class SystemCertData:
+
+ def __init__(self):
+ pass
+
+class SystemConfigClient:
+
+ def __init__(self, connection):
+ self.connection = connection
+
+ def configure(self, data):
+ headers = {'Content-type': 'application/json',
+ 'Accept': 'application/json'}
+ r = self.connection.post('/rest/installer/configure', data, headers)
+ info = r.json()['ConfigurationResponse']
+ return info
+
+class SystemStatusClient:
+
+ def __init__(self, connection):
+ self.connection = connection
+
+ def getStatus(self):
+ r = self.connection.get('/admin/' +\
+ self.connection.subsystem + '/getStatus')
+ return r.text
+
+
+