Skip to content

Commit 6e275e1

Browse files
sdagueBharat Kumar Kobagana
authored andcommitted
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 <[email protected]> Change-Id: I13c961b19bdcc1a99e9a7068fe91bbaac787e948
1 parent 4cc060e commit 6e275e1

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

functions-common

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,33 @@ function load_plugin_settings {
15011501
done
15021502
}
15031503

1504+
# plugin_override_defaults
1505+
#
1506+
# Run an extremely early setting phase for plugins that allows default
1507+
# overriding of services.
1508+
function plugin_override_defaults {
1509+
local plugins="${DEVSTACK_PLUGINS}"
1510+
local plugin
1511+
1512+
# short circuit if nothing to do
1513+
if [[ -z $plugins ]]; then
1514+
return
1515+
fi
1516+
1517+
echo "Overriding Configuration Defaults"
1518+
for plugin in ${plugins//,/ }; do
1519+
local dir=${GITDIR[$plugin]}
1520+
# source any overrides
1521+
if [[ -f $dir/devstack/override-defaults ]]; then
1522+
# be really verbose that an override is happening, as it
1523+
# may not be obvious if things fail later.
1524+
echo "$plugin has overriden the following defaults"
1525+
cat $dir/devstack/override-defaults
1526+
source $dir/devstack/override-defaults
1527+
fi
1528+
done
1529+
}
1530+
15041531
# run_plugins
15051532
#
15061533
# Run the devstack/plugin.sh in all the plugin directories. These are
@@ -1530,6 +1557,8 @@ function run_phase {
15301557
# the source phase corresponds to settings loading in plugins
15311558
if [[ "$mode" == "source" ]]; then
15321559
load_plugin_settings
1560+
elif [[ "$mode" == "override_defaults" ]]; then
1561+
plugin_override_defaults
15331562
else
15341563
run_plugins $mode $phase
15351564
fi

stack.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,10 @@ fi
507507
# Configure Projects
508508
# ==================
509509

510+
# Plugin Phase 0: override_defaults - allow pluggins to override
511+
# defaults before other services are run
512+
run_phase override_defaults
513+
510514
# Import apache functions
511515
source $TOP_DIR/lib/apache
512516

unstack.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ fi
4545
# Configure Projects
4646
# ==================
4747

48+
# Plugin Phase 0: override_defaults - allow pluggins to override
49+
# defaults before other services are run
50+
run_phase override_defaults
51+
4852
# Import apache functions
4953
source $TOP_DIR/lib/apache
5054

0 commit comments

Comments
 (0)