forked from Krautspace/doorstatus
statusd.py: certs_readable() checks if cert is defined
This commit is contained in:
parent
35d46f266a
commit
fa772012d6
1 changed files with 6 additions and 2 deletions
|
@ -42,9 +42,13 @@ def read_config(CONFIGFILE, CONFIG):
|
||||||
|
|
||||||
|
|
||||||
def certs_readable(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']):
|
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))
|
logging.error('Cant read {}'.format(i))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue