Browse code

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

Sean Dague authored on 2015/09/08 20:12:48
Showing 2 changed files
... ...
@@ -157,6 +157,28 @@ function use_library_from_git {
157 157
     return $enabled
158 158
 }
159 159
 
160
+# determine if a package was installed from git
161
+function lib_installed_from_git {
162
+    local name=$1
163
+    pip freeze 2>/dev/null | grep -- "$name" | grep -q -- '-e git'
164
+}
165
+
166
+# check that everything that's in LIBS_FROM_GIT was actually installed
167
+# correctly, this helps double check issues with library fat fingering.
168
+function check_libs_from_git {
169
+    local lib=""
170
+    local not_installed=""
171
+    for lib in $(echo ${LIBS_FROM_GIT} | tr "," " "); do
172
+        if ! lib_installed_from_git "$lib"; then
173
+            not_installed+=" $lib"
174
+        fi
175
+    done
176
+    # if anything is not installed, say what it is.
177
+    if [[ -n "$not_installed" ]]; then
178
+        die $LINENO "The following LIBS_FROM_GIT were not installed correct: $not_installed"
179
+    fi
180
+}
181
+
160 182
 # setup a library by name. If we are trying to use the library from
161 183
 # git, we'll do a git based install, otherwise we'll punt and the
162 184
 # library should be installed by a requirements pull from another
... ...
@@ -1373,9 +1373,16 @@ if [[ -x $TOP_DIR/local.sh ]]; then
1373 1373
     $TOP_DIR/local.sh
1374 1374
 fi
1375 1375
 
1376
+# Sanity checks
1377
+# =============
1378
+
1376 1379
 # Check the status of running services
1377 1380
 service_check
1378 1381
 
1382
+# ensure that all the libraries we think we installed from git,
1383
+# actually were.
1384
+check_libs_from_git
1385
+
1379 1386
 
1380 1387
 # Bash completion
1381 1388
 # ===============