blob: 9a509d8318cfe05601f6d60fed3fdf54b54f8c96 [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
19 if [[ -n ${PROJECT_VENV[$service]:-} ]]; then
20 rm -rf ${PROJECT_VENV[$service]}
Sean Dagueaa8d31a2015-02-20 06:10:48 -050021 source $TOP_DIR/tools/build_venv.sh ${PROJECT_VENV[$service]}
Dean Troyer8c2ce6e2015-02-18 14:47:54 -060022 export PIP_VIRTUAL_ENV=${PROJECT_VENV[$service]:-}
23 fi
24 install_${service}
25 if [[ -n ${PROJECT_VENV[$service]:-} ]]; then
26 unset PIP_VIRTUAL_ENV
27 fi
28 fi
29}