provide an override-defaults phase

during the glusterfs integration it was seen that plugins might need
to set new defaults on projects before the project files load. Create
a new override-defaults phase for that.

Intentionally not adding to the documentation yet until we're sure
this works right in the glusterfs case.

Reported-By: Deepak C Shetty <deepakcs@redhat.com>
Change-Id: I13c961b19bdcc1a99e9a7068fe91bbaac787e948
This commit is contained in:
Sean Dague 2015-03-26 05:54:28 -04:00 committed by Bharat Kumar Kobagana
parent 4cc060e77c
commit 6e275e170c
3 changed files with 37 additions and 0 deletions

View File

@ -1501,6 +1501,33 @@ function load_plugin_settings {
done
}
# plugin_override_defaults
#
# Run an extremely early setting phase for plugins that allows default
# overriding of services.
function plugin_override_defaults {
local plugins="${DEVSTACK_PLUGINS}"
local plugin
# short circuit if nothing to do
if [[ -z $plugins ]]; then
return
fi
echo "Overriding Configuration Defaults"
for plugin in ${plugins//,/ }; do
local dir=${GITDIR[$plugin]}
# source any overrides
if [[ -f $dir/devstack/override-defaults ]]; then
# be really verbose that an override is happening, as it
# may not be obvious if things fail later.
echo "$plugin has overriden the following defaults"
cat $dir/devstack/override-defaults
source $dir/devstack/override-defaults
fi
done
}
# run_plugins
#
# Run the devstack/plugin.sh in all the plugin directories. These are
@ -1530,6 +1557,8 @@ function run_phase {
# the source phase corresponds to settings loading in plugins
if [[ "$mode" == "source" ]]; then
load_plugin_settings
elif [[ "$mode" == "override_defaults" ]]; then
plugin_override_defaults
else
run_plugins $mode $phase
fi

View File

@ -507,6 +507,10 @@ fi
# Configure Projects
# ==================
# Plugin Phase 0: override_defaults - allow pluggins to override
# defaults before other services are run
run_phase override_defaults
# Import apache functions
source $TOP_DIR/lib/apache

View File

@ -45,6 +45,10 @@ fi
# Configure Projects
# ==================
# Plugin Phase 0: override_defaults - allow pluggins to override
# defaults before other services are run
run_phase override_defaults
# Import apache functions
source $TOP_DIR/lib/apache