Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions docs/source/Reference/sr3.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,16 @@ It is actually building the effective configuration from:

2. admin.conf

3. <component>.conf (subscribe.conf, audit.conf, etc...)
3. <component>/default.inc

4. <component>/<config>.conf

Settings in an individual .conf file are read in after the default.conf
file, and so can override defaults. Options specified on
the command line override configuration files.
Settings in a default.inc include file (from the parent <component> directory)
are read in after the default.conf and prior to <component>/<config>.conf.
So this allows to override the values for the component chosen.
Options specified in the configuration file override values in the components' default.inc.

Options specified on the command line override configuration files.

While one can manage configuration files using the *add*, *remove*,
*list*, *edit*, *disable*, and *enable* actions, one can also do all
Expand Down
16 changes: 9 additions & 7 deletions docs/source/fr/Reference/sr3.1.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
=====
SR3
SR3
=====

------------------
sr3 Sarracenia CLI
------------------

:Manual section: 1
:Manual section: 1
:Date: |today|
:Version: |release|
:Manual group: MetPX-Sarracenia
Expand Down Expand Up @@ -112,14 +112,16 @@ la configuration se fait construire a partir de:

2. admin.conf

3. <component>.conf (subscribe.conf, audit.conf, etc...)
3. <component>/default.inc

4. <component>/<config>.conf

Les paramètres d'un fichier .conf sont lu après le fichier default.conf,
et les valeurs initiales choisi par défaut peuvent éventuellement être replacer.
Les options spécifiées sur la ligne de commande remplacent les options spécifiées dans le
fichier de configuration.

Les paramètres du fichier d'inclusion default.inc (situé dans le répertoire parent <component>)
sont lus après default.conf et avant <component>/<config>.conf.
Cela permet donc de remplacer les valeurs par défaut du component sélectionné.
Les options spécifiées dans le fichier de configuration remplacent les valeurs du fichier default.inc du component.
Les options spécifiées en ligne de commande remplacent ceux des fichiers de configuration.

Les fichiers de configurations peuvent être gérer en utilisant les actions *add*, *remove*,
*list*, *edit*, *disable*, et *enable*. Il est également possible de faire
Expand Down
10 changes: 10 additions & 0 deletions sarracenia/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,14 @@ def applyComponentDefaults( self, component ):
if hasattr(component_module, 'default_options'):
self.override(component_module.default_options)

def addComponentDefaultInc( self , component ):
"""
Added from issue 1196
Parse and add component/default.inc options if the file exists.
"""
if os.path.exists(get_user_config_dir() + os.sep + component + os.sep + 'default.inc'):
self.parse_file(get_user_config_dir() + os.sep + component + os.sep + 'default.inc', component)

@property
def admin(self):
return self.__admin
Expand Down Expand Up @@ -2890,6 +2898,8 @@ def one_config(component, config, action, isPost=False, hostDir=None):
os.chdir(get_user_config_dir())
os.chdir(component)

cfg.addComponentDefaultInc( component )

if config[-5:] != '.conf':
fname = os.path.expanduser(config + '.conf')
else:
Expand Down
2 changes: 2 additions & 0 deletions sarracenia/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ def _read_configs(self):
'action': self.options.action,
'directory': '${PWD}'
})
# Apply component defaults from source
cfgbody.applyComponentDefaults( c )
cfgbody.addComponentDefaultInc( c )
cfgbody.parse_file(cfg,c)
cfgbody.finalize(c, cfg)
self.configs[c][cbase]['options'] = cfgbody
Expand Down
Loading
Loading