Typo in section header in config silently disables all config parsing

Bug #1412798 reported by George Shuklin
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Hassaan Pasha

Bug Description

I know it sounds silly, but I just spend five hours trying to find why glance is not working with swift and printing random erros. At the end I had found it had ignored all debug/log settings, and later I had found the source of the problem - small typo in my config.

If config contains '[[DEFAULT]' instead of '[DEFAULT]' glance ignores all setting in section (i think it is not only for 'default', but 'default' is the most devastating, because it disables logging and logging locations).

Proposed solution: write down a warning to stdout if configuration file contains no '[DEFAULT]' section.

Revision history for this message
Louis Taylor (kragniz) wrote :

This doesn't actually work for me on master. On a plain devstack installation, replacing [DEFAULT] with [[DEFAULT] or [xDEFAULT] in /etc/glance/glance-api.conf causes the service to fail to start. It complains it can't read a certain option from the config file:

    2015-01-20 15:28:29.916 5741 TRACE glance BadDriverConfiguration: Driver glance.image_cache.drivers.sqlite could not be configured correctly. Reason: Failed to read image_cache_dir from config

Do you have some steps to reproduce?

Louis Taylor (kragniz)
Changed in glance:
status: New → Incomplete
importance: Undecided → Medium
Revision history for this message
George Shuklin (george-shuklin) wrote :

Hello. I check it on juno (sorry, got no devstack nearby).

Conditions:

1. Install any favorite distibution (I check it on ubuntu, but others should behave same way)
2. Stop system-wide glance (service glance-api stop)
3. Keep all other configuration files as is (paste.ini, etc).
3. In glance-api.conf replace [default] with [[default]
4. run glance-api from command line.

It will run without any complains to stdout and will ignore all settings in [[default] section.

Minimal 'bad' config it can use without complains looks like this:

[[DEFAULT]
image_cache_dir = /var/lib/glance/image-cache/
[glance_store]
filesystem_store_datadir = /var/lib/glance/images/

Changed in glance:
status: Incomplete → New
Revision history for this message
Inessa Vasilevskaya (ivasilevskaya) wrote :

I checked it on kilo -> server fails to start with the same trace as Louis mentioned:
2015-02-26 19:38:23.519 10003 TRACE glance BadDriverConfiguration: Driver glance.image_cache.drivers.sqlite could not be configured correctly. Reason: Failed to read image_cache_dir from config

Revision history for this message
Kamil Rykowski (kamil-rykowski) wrote :

Right, checked it on the latest master branch and the same behaviour occurs (BadDriverConfiguration).

Hassaan Pasha (hassaanp)
Changed in glance:
status: New → Confirmed
Revision history for this message
Hassaan Pasha (hassaanp) wrote :

I reconfirmed on Juno.

The error message is handled by the following excerpt:

if self.base_dir is None:
            msg = _('Failed to read %s from config') % 'image_cache_dir'

Changing tags other than [Default] doesn't cause any trouble.
So should we simply change the error message to a more revealing one?

Hassaan Pasha (hassaanp)
Changed in glance:
assignee: nobody → Hassaan Pasha (hassaanp)
Hassaan Pasha (hassaanp)
Changed in glance:
status: Confirmed → In Progress
status: In Progress → Fix Committed
Changed in glance:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: liberty-1 → 11.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.