blob: 7d98604b82ef6ce4913cf24dba028496f6a1c700 [file] [log] [blame]
Dean Troyer8c2ce6e2015-02-18 14:47:54 -06001#!/bin/bash
2#
3# lib/stack
4#
Dean Troyerdc97cb72015-03-28 08:20:50 -05005# These functions are code snippets pulled out of ``stack.sh`` for easier
Dean Troyer8c2ce6e2015-02-18 14:47:54 -06006# re-use by Grenade. They can assume the same environment is available
Dean Troyerdc97cb72015-03-28 08:20:50 -05007# as in the lower part of ``stack.sh``, namely a valid stackrc has been sourced
8# as well as all of the ``lib/*`` files for the services have been sourced.
Dean Troyer8c2ce6e2015-02-18 14:47:54 -06009#
10# For clarity, all functions declared here that came from ``stack.sh``
11# shall be named with the prefix ``stack_``.
12
13
Dean Troyerdc97cb72015-03-28 08:20:50 -050014# Functions
15# ---------
16
Atsushi SAKAIfe7b56c2015-11-13 17:06:16 +090017# Generic service install handles venv creation if configured for service
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060018# stack_install_service service
19function stack_install_service {
20 local service=$1
21 if type install_${service} >/dev/null 2>&1; then
Dean Troyer5686dbc2015-03-09 14:27:51 -050022 if [[ ${USE_VENV} = True && -n ${PROJECT_VENV[$service]:-} ]]; then
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060023 rm -rf ${PROJECT_VENV[$service]}
Dean Troyer5686dbc2015-03-09 14:27:51 -050024 source $TOP_DIR/tools/build_venv.sh ${PROJECT_VENV[$service]} ${ADDITIONAL_VENV_PACKAGES//,/ }
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060025 export PIP_VIRTUAL_ENV=${PROJECT_VENV[$service]:-}
Dean Troyer5686dbc2015-03-09 14:27:51 -050026
27 # Install other OpenStack prereqs that might come from source repos
28 install_oslo
29 install_keystonemiddleware
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060030 fi
31 install_${service}
Dean Troyer5686dbc2015-03-09 14:27:51 -050032 if [[ ${USE_VENV} = True && -n ${PROJECT_VENV[$service]:-} ]]; then
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060033 unset PIP_VIRTUAL_ENV
34 fi
35 fi
36}