|
69 | 69 | HEAT_STACK_DOMAIN=$(trueorfalse True HEAT_STACK_DOMAIN)
|
70 | 70 | HEAT_DEFERRED_AUTH=${HEAT_DEFERRED_AUTH:-trusts}
|
71 | 71 | fi
|
| 72 | +HEAT_PLUGIN_DIR=${HEAT_PLUGIN_DIR:-$DATA_DIR/heat/plugins} |
| 73 | +ENABLE_HEAT_PLUGINS=${ENABLE_HEAT_PLUGINS:-} |
72 | 74 |
|
73 | 75 | # Functions
|
74 | 76 | # ---------
|
@@ -188,6 +190,35 @@ function configure_heat {
|
188 | 190 | # copy the default templates
|
189 | 191 | cp $HEAT_DIR/etc/heat/templates/* $HEAT_TEMPLATES_DIR/
|
190 | 192 |
|
| 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." |
191 | 222 | }
|
192 | 223 |
|
193 | 224 | # init_heat() - Initialize database
|
|
0 commit comments