From 0bb89137943a7406064185c8f6299334cfa39a0a Mon Sep 17 00:00:00 2001 From: Martijn Alberts Date: Mon, 9 Dec 2019 17:10:38 +0100 Subject: [PATCH] Add check for settings key --- files_admin/files_admin.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/files_admin/files_admin.py b/files_admin/files_admin.py index aafa1bf..1b7dfad 100644 --- a/files_admin/files_admin.py +++ b/files_admin/files_admin.py @@ -54,6 +54,14 @@ def files(options): files = options.file.split(',') for file in files: configfile = ConfigObj(file) + + # Check if the settings section key is present in the file + try: + value = configfile['setting'] + except KeyError: + print('Setting does not exist in', file) + continue + if configfile['setting'].as_bool('use_zarafa_credentials'): username = options.user else: