Page MenuHomeDevCentral

CLI client: ensure configuration file could be read
Open, LowPublic

Description

If the configuration file exists, but in a chmod not accessible for the user, no rights check is done, and Python doesn't seem to wish to raise an error.

It will fail when the script needs a setting, but it should fail before with an explicit ''Can't read configuration file'' error.

Ysul (without rights to read /usr/local/etc/notifications.conf)
$ notifications 
Traceback (most recent call last):
  File "/usr/local/bin/notifications", line 180, in <module>
    app = initializeApplication()
  File "/usr/local/bin/notifications", line 138, in initializeApplication
    app['channel'] = getChannel(app['config'])
  File "/usr/local/bin/notifications", line 117, in getChannel
    return getConnection(config).channel()
  File "/usr/local/bin/notifications", line 107, in getConnection
    return getBrokerConnection(config)
  File "/usr/local/bin/notifications", line 44, in getBrokerConnection
    host=config['Broker']['Host'],
  File "/usr/local/lib/python3.4/configparser.py", line 936, in __getitem__
    raise KeyError(key)
KeyError: 'Broker'