Skip to content

Commit

Permalink
Adding minor bug fixes to sync with 10.6 (#93)
Browse files Browse the repository at this point in the history
- Skip loading file if cs_conf doesn't exist
- Reformat log error in initialization

Signed-off-by: Dinesh Prasanth M K <dmoluguw@redhat.com>
  • Loading branch information
SilleBille committed Nov 1, 2018
1 parent c6c6757 commit 087d3a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
29 changes: 15 additions & 14 deletions base/server/python/pki/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,21 @@ def __hash__(self):
def load(self):
self.config.clear()

lines = open(self.cs_conf).read().splitlines()

for index, line in enumerate(lines):
if not line or line.startswith('#'):
continue
parts = line.split('=', 1)
if len(parts) < 2:
raise Exception('Missing delimiter in %s line %d' % (self.cs_conf, index + 1))
name = parts[0]
value = parts[1]
self.config[name] = value

self.type = self.config['cs.type']
self.prefix = self.type.lower()
if os.path.exists(self.cs_conf):
lines = open(self.cs_conf).read().splitlines()

for index, line in enumerate(lines):
if not line or line.startswith('#'):
continue
parts = line.split('=', 1)
if len(parts) < 2:
raise Exception('Missing delimiter in %s line %d' % (self.cs_conf, index + 1))
name = parts[0]
value = parts[1]
self.config[name] = value

self.type = self.config['cs.type']
self.prefix = self.type.lower()

def find_system_certs(self):
certs = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def destroy(self, deployer):
deployer.security_domain.deregister(None)

except Exception as e: # pylint: disable=broad-except
config.pki_log.error(str(e))
config.pki_log.error(log.PKI_OSERROR_1, e,
extra=config.PKI_INDENTATION_LEVEL_0)
# If it is a normal destroy, pass any exception
if not deployer.mdict['pki_force_destroy']:
raise
Expand Down

0 comments on commit 087d3a5

Please sign in to comment.