Dean Troyer | 8c2ce6e | 2015-02-18 14:47:54 -0600 | [diff] [blame^] | 1 | #!/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 |
| 16 | function 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]} |
| 21 | source tools/build_venv.sh ${PROJECT_VENV[$service]} |
| 22 | 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 | } |