From fa772012d65ab23c0c7ad3dc386e9de6d53845eb Mon Sep 17 00:00:00 2001 From: +++ Date: Tue, 30 Jul 2019 22:20:45 +0200 Subject: [PATCH] statusd.py: certs_readable() checks if cert is defined --- statusd.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/statusd.py b/statusd.py index dc68d3c..53a324a 100755 --- a/statusd.py +++ b/statusd.py @@ -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