summaryrefslogtreecommitdiffstats
path: root/base/deploy/src/scriptlets/pkiparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'base/deploy/src/scriptlets/pkiparser.py')
-rw-r--r--base/deploy/src/scriptlets/pkiparser.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/base/deploy/src/scriptlets/pkiparser.py b/base/deploy/src/scriptlets/pkiparser.py
index c70ed84b2..49b4f94bb 100644
--- a/base/deploy/src/scriptlets/pkiparser.py
+++ b/base/deploy/src/scriptlets/pkiparser.py
@@ -35,8 +35,13 @@ import pkiconfig as config
import pkimessages as log
+class PKIConfigParser:
+
+ COMMENT_CHAR = '#'
+ OPTION_CHAR = '='
+
# PKI Deployment Helper Functions
- def process_command_line_arguments(argv):
+ def process_command_line_arguments(self, argv):
"Read and process command-line options"
config.pki_deployment_executable = os.path.basename(argv[0])
description = None
@@ -184,21 +189,19 @@ import pkimessages as log
# The following code is based heavily upon
# "http://www.decalage.info/en/python/configparser"
- COMMENT_CHAR = '#'
- OPTION_CHAR = '='
-
+ @staticmethod
def read_simple_configuration_file(filename):
values = {}
f = open(filename)
for line in f:
# First, remove comments:
- if COMMENT_CHAR in line:
+ if PKIConfigParser.COMMENT_CHAR in line:
# split on comment char, keep only the part before
- line, comment = line.split(COMMENT_CHAR, 1)
+ line, comment = line.split(PKIConfigParser.COMMENT_CHAR, 1)
# Second, find lines with an name=value:
- if OPTION_CHAR in line:
+ if PKIConfigParser.OPTION_CHAR in line:
# split on name char:
- name, value = line.split(OPTION_CHAR, 1)
+ name, value = line.split(PKIConfigParser.OPTION_CHAR, 1)
# strip spaces:
name = name.strip()
value = value.strip()
@@ -208,7 +211,7 @@ import pkimessages as log
return values
- def read_pki_configuration_file():
+ def read_pki_configuration_file(self):
"Read configuration file sections into dictionaries"
rv = 0
try:
@@ -246,7 +249,7 @@ import pkimessages as log
return rv
- def compose_pki_master_dictionary():
+ def compose_pki_master_dictionary(self):
"Create a single master PKI dictionary from the sectional dictionaries"
try:
config.pki_master_dict = dict()
@@ -2343,7 +2346,7 @@ import pkimessages as log
return
- def compose_pki_slots_dictionary():
+ def compose_pki_slots_dictionary(self):
"""Read the slots configuration file to create
the appropriate PKI slots dictionary"""
rv = 0