|
Alan Pevec |
8dd8a65 |
From 37b6d32f43c2f0f11a87674a8dc1278af09fdec9 Mon Sep 17 00:00:00 2001
|
|
|
c573f8e |
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <pbrady@redhat.com>
|
|
|
c573f8e |
Date: Mon, 11 Feb 2013 17:32:55 +0000
|
|
Alan Pevec |
af6f3ae |
Subject: [PATCH] add /usr/share/$project/*-dist.conf to the default config set
|
|
|
c573f8e |
|
|
|
c573f8e |
This will lookup /usr/share/$project/$project-dist.conf
|
|
Alan Pevec |
af6f3ae |
and /usr/share/$project/$prog-dist.conf
|
|
|
c573f8e |
in the correct precedence order by default.
|
|
|
c573f8e |
For example from command line utils which don't specify
|
|
|
c573f8e |
the --config-file option. Note if daemon init scripts
|
|
|
c573f8e |
explicitly specify a --config-file then they must specify
|
|
|
c573f8e |
all required.
|
|
|
c573f8e |
|
|
|
c573f8e |
For reference the precedence order is that later --config-file
|
|
|
c573f8e |
options will override settings from previous ones.
|
|
|
c573f8e |
So when no --config-file option is specified, we insert
|
|
|
c573f8e |
the "dist" config file as the first to be parsed,
|
|
|
c573f8e |
and settings from there are overridden by any from
|
|
|
c573f8e |
/etc/$project/$project.conf and /etc/$prog.conf respectively.
|
|
|
c573f8e |
|
|
|
c573f8e |
For completeness, note settings in configs from --config-dir
|
|
|
c573f8e |
take precedence over any of the --config-file settings above.
|
|
|
c573f8e |
---
|
|
Alan Pevec |
37b5ef1 |
oslo_config/cfg.py | 4 ++++
|
|
Alan Pevec |
af6f3ae |
1 file changed, 4 insertions(+)
|
|
|
c573f8e |
|
|
Alan Pevec |
37b5ef1 |
diff --git a/oslo_config/cfg.py b/oslo_config/cfg.py
|
|
Alan Pevec |
8dd8a65 |
index 77fd44d..902d5a5 100644
|
|
Alan Pevec |
37b5ef1 |
--- a/oslo_config/cfg.py
|
|
Alan Pevec |
37b5ef1 |
+++ b/oslo_config/cfg.py
|
|
Alan Pevec |
37b5ef1 |
@@ -550,6 +550,10 @@ def find_config_files(project=None, prog=None, extension='.conf'):
|
|
|
c573f8e |
|
|
|
c573f8e |
config_files = []
|
|
|
c573f8e |
if project:
|
|
|
c573f8e |
+ config_files.append(_search_dirs(['/usr/share/%s/' % project],
|
|
|
c573f8e |
+ project, '-dist%s' % extension))
|
|
Alan Pevec |
af6f3ae |
+ config_files.append(_search_dirs(['/usr/share/%s/' % project],
|
|
Alan Pevec |
af6f3ae |
+ prog, '-dist%s' % extension))
|
|
|
c573f8e |
config_files.append(_search_dirs(cfg_dirs, project, extension))
|
|
|
c573f8e |
config_files.append(_search_dirs(cfg_dirs, prog, extension))
|
|
|
c573f8e |
|