check if spool dir exists and is usable

This commit is contained in:
Paolo Asperti 2017-12-28 22:59:16 +01:00
parent acf09f14b3
commit ba1ac98a61

View File

@ -162,7 +162,13 @@ configParser = ConfigParser.RawConfigParser()
configParser.read('telegram-notify.conf') configParser.read('telegram-notify.conf')
spool_dir = configParser.get('general', 'spool_dir') spool_dir = configParser.get('general', 'spool_dir')
# TODO: check if spool_dir exists and is a dir if not os.path.isdir(spool_dir):
print "spool directory (%s) doesn't exists or is not a directory!" % spool_dir
sys.exit(1)
if not os.access(spool_dir, os.W_OK):
print "spool directory (%s) is not writable!" % spool_dir
sys.exit(1)
chat_ids=[] chat_ids=[]
print "Allowed users: " print "Allowed users: "