From 6e275e170c042794560c9b2c442a32c3de55566e Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 26 Mar 2015 05:54:28 -0400 Subject: [PATCH] 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 Change-Id: I13c961b19bdcc1a99e9a7068fe91bbaac787e948 --- functions-common | 29 +++++++++++++++++++++++++++++ stack.sh | 4 ++++ unstack.sh | 4 ++++ 3 files changed, 37 insertions(+) diff --git a/functions-common b/functions-common index 48e400dfb1..9bad981ab1 100644 --- a/functions-common +++ b/functions-common @@ -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 diff --git a/stack.sh b/stack.sh index 9069367fa0..a9deba7ff6 100755 --- a/stack.sh +++ b/stack.sh @@ -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 diff --git a/unstack.sh b/unstack.sh index a66370b1e9..c45af7400c 100755 --- a/unstack.sh +++ b/unstack.sh @@ -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