From 73c1df668b3913ad80ae312c355414a81ddda7e1 Mon Sep 17 00:00:00 2001 From: Richard Phillis Date: Mar 27 2018 10:18:52 +0000 Subject: Ensure log output is produced if config file is unreadable --- diff --git a/hub/kojixmlrpc.py b/hub/kojixmlrpc.py index f518da8..07b3663 100644 --- a/hub/kojixmlrpc.py +++ b/hub/kojixmlrpc.py @@ -387,8 +387,13 @@ def load_config(environ): configs = koji.config_directory_contents(cfdir) else: configs = [] - if cf and os.path.isfile(cf): - configs.append(cf) + if cf: + # Only consider the config file only if it is a readable file + if os.path.isfile(cf) and os.access(cf, os.R_OK): + configs.append(cf) + else: + # Log the permissions error if the config file is not readable + logger.error('Unable to read configuration file (%s)', cf) if configs: config = RawConfigParser() config.read(configs)