From c71973eb04d05c2497eb930c4e1b59dcaf983085 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 8 Sep 2015 07:12:48 -0400 Subject: [PATCH] check LIBS_FROM_GIT after the glance_store vs. upper-constraints bug, it's probably worth actually enforcing and sanity checking that devstack is doing what it's being asked of with LIBS_FROM_GIT. This will hopefully reduce user generated error. This *might* not work with the current oslo naming, we'll have to test and normalize that. Change-Id: Iffef2007f99a0e932b68c4c897ebbfb748cac2b4 --- inc/python | 22 ++++++++++++++++++++++ stack.sh | 7 +++++++ 2 files changed, 29 insertions(+) diff --git a/inc/python b/inc/python index 5c9dc5c3e5..210a9dbdfe 100644 --- a/inc/python +++ b/inc/python @@ -157,6 +157,28 @@ function use_library_from_git { return $enabled } +# determine if a package was installed from git +function lib_installed_from_git { + local name=$1 + pip freeze 2>/dev/null | grep -- "$name" | grep -q -- '-e git' +} + +# check that everything that's in LIBS_FROM_GIT was actually installed +# correctly, this helps double check issues with library fat fingering. +function check_libs_from_git { + local lib="" + local not_installed="" + for lib in $(echo ${LIBS_FROM_GIT} | tr "," " "); do + if ! lib_installed_from_git "$lib"; then + not_installed+=" $lib" + fi + done + # if anything is not installed, say what it is. + if [[ -n "$not_installed" ]]; then + die $LINENO "The following LIBS_FROM_GIT were not installed correct: $not_installed" + fi +} + # setup a library by name. If we are trying to use the library from # git, we'll do a git based install, otherwise we'll punt and the # library should be installed by a requirements pull from another diff --git a/stack.sh b/stack.sh index accfd0ac3e..638d471654 100755 --- a/stack.sh +++ b/stack.sh @@ -1373,9 +1373,16 @@ if [[ -x $TOP_DIR/local.sh ]]; then $TOP_DIR/local.sh fi +# Sanity checks +# ============= + # Check the status of running services service_check +# ensure that all the libraries we think we installed from git, +# actually were. +check_libs_from_git + # Bash completion # ===============