Skip to content

Commit a9e92c2

Browse files
Jenkinsopenstack-gerrit
Jenkins
authored andcommitted
Merge "Add the ability to install/enable Heat plugins"
2 parents b37ca0f + 347dbac commit a9e92c2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

lib/heat

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ else
6969
HEAT_STACK_DOMAIN=$(trueorfalse True HEAT_STACK_DOMAIN)
7070
HEAT_DEFERRED_AUTH=${HEAT_DEFERRED_AUTH:-trusts}
7171
fi
72+
HEAT_PLUGIN_DIR=${HEAT_PLUGIN_DIR:-$DATA_DIR/heat/plugins}
73+
ENABLE_HEAT_PLUGINS=${ENABLE_HEAT_PLUGINS:-}
7274

7375
# Functions
7476
# ---------
@@ -188,6 +190,35 @@ function configure_heat {
188190
# copy the default templates
189191
cp $HEAT_DIR/etc/heat/templates/* $HEAT_TEMPLATES_DIR/
190192

193+
# Enable heat plugins.
194+
# NOTE(nic): The symlink nonsense is necessary because when
195+
# plugins are installed in "developer mode", the final component
196+
# of their target directory is always "resources", which confuses
197+
# Heat's plugin loader into believing that all plugins are named
198+
# "resources", and therefore are all the same plugin; so it
199+
# will only load one of them. Linking them all to a common
200+
# location with unique names avoids that type of collision,
201+
# while still allowing the plugins to be edited in-tree.
202+
local err_count=0
203+
204+
if [ -n "$ENABLE_HEAT_PLUGINS" ]; then
205+
mkdir -p $HEAT_PLUGIN_DIR
206+
# Clean up cruft from any previous runs
207+
rm -f $HEAT_PLUGIN_DIR/*
208+
iniset $HEAT_CONF DEFAULT plugin_dirs $HEAT_PLUGIN_DIR
209+
fi
210+
211+
for heat_plugin in $ENABLE_HEAT_PLUGINS; do
212+
if [ -d $HEAT_DIR/contrib/$heat_plugin ]; then
213+
setup_package $HEAT_DIR/contrib/$heat_plugin -e
214+
ln -s $HEAT_DIR/contrib/$heat_plugin/$heat_plugin/resources $HEAT_PLUGIN_DIR/$heat_plugin
215+
else
216+
: # clear retval on the test so that we can roll up errors
217+
err $LINENO "Requested Heat plugin(${heat_plugin}) not found."
218+
err_count=$(($err_count + 1))
219+
fi
220+
done
221+
[ $err_count -eq 0 ] || die $LINENO "$err_count of the requested Heat plugins could not be installed."
191222
}
192223

193224
# init_heat() - Initialize database

0 commit comments

Comments
 (0)