blob: 11dd87ca28bd60c91391d83227eb505325826091 [file] [log] [blame]
Dean Troyer8c2ce6e2015-02-18 14:47:54 -06001#!/bin/bash
2#
3# lib/stack
4#
5# These functions are code snippets pulled out of stack.sh for easier
6# re-use by Grenade. They can assume the same environment is available
7# 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.
9#
10# For clarity, all functions declared here that came from ``stack.sh``
11# shall be named with the prefix ``stack_``.
12
13
14# Generic service install handles venv creation if confgured for service
15# stack_install_service service
16function stack_install_service {
17 local service=$1
18 if type install_${service} >/dev/null 2>&1; then
Dean Troyer5686dbc2015-03-09 14:27:51 -050019 if [[ ${USE_VENV} = True && -n ${PROJECT_VENV[$service]:-} ]]; then
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060020 rm -rf ${PROJECT_VENV[$service]}
Dean Troyer5686dbc2015-03-09 14:27:51 -050021 source $TOP_DIR/tools/build_venv.sh ${PROJECT_VENV[$service]} ${ADDITIONAL_VENV_PACKAGES//,/ }
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060022 export PIP_VIRTUAL_ENV=${PROJECT_VENV[$service]:-}
Dean Troyer5686dbc2015-03-09 14:27:51 -050023
24 # Install other OpenStack prereqs that might come from source repos
25 install_oslo
26 install_keystonemiddleware
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060027 fi
28 install_${service}
Dean Troyer5686dbc2015-03-09 14:27:51 -050029 if [[ ${USE_VENV} = True && -n ${PROJECT_VENV[$service]:-} ]]; then
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060030 unset PIP_VIRTUAL_ENV
31 fi
32 fi
33}