statusd.py: certs_readable() checks if cert is defined

This commit is contained in:
+++ 2019-07-30 22:20:45 +02:00
parent 35d46f266a
commit fa772012d6

View file

@ -42,9 +42,13 @@ def read_config(CONFIGFILE, CONFIG):
def certs_readable(config):
'''
checks at start, if the needed certificates defined (no nullstring) and readable.
param 1: dictionary
return: boolean
'''
for i in (config['SERVER_KEY'], config['SERVER_CERT'], config['CLIENT_CERT']):
if os.access(i, os.R_OK) == False:
if i == '' or os.access(i, os.R_OK) == False:
logging.error('Cant read {}'.format(i))
return False
return True