From 91e2466f2dd9dcdcaf1d443be66b51c861182784 Mon Sep 17 00:00:00 2001
From: Kui Shi <skuicloud@gmail.com>
Date: Sat, 31 Aug 2013 19:24:38 +0800
Subject: [PATCH] Add venv wrapper for check_uptodate.sh

tools/conf/check_uptodate.sh is added in run_tests.sh

For simple, run "run_tests.sh -p" will call it, and get following error:

Failed to collect options from module
cinder.volume.drivers.san.hp.hp_3par_common: No module named hp3parclient

Actually, the hp3parclient is listed in test-requirements.txt, and it is
installed in venv.

the check_uptodate.sh should run in venv to get correct result.

update the error message to update the cindier.conf.sample correctly.

-----------
Test method
-----------
$ pwd
/opt/stack/cinder

$ source .venv/bin/activate; tools/conf/generate_sample.sh

(.venv)$ deactivate

$ ./run_tests.sh  -p
Running flake8 ...
// no error emitted here

Fixes Bug #1219197

Change-Id: I9b3eaf3c1a5eb395eefed28bb907685cdef147aa
---
 run_tests.sh                 | 4 ++--
 tools/conf/check_uptodate.sh | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/run_tests.sh b/run_tests.sh
index 6e9e17d85..ae6e365bb 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -227,7 +227,7 @@ fi
 
 if [ $just_pep8 -eq 1 ]; then
     run_pep8
-    bash ./tools/conf/check_uptodate.sh
+    ${wrapper}   bash ./tools/conf/check_uptodate.sh
     exit
 fi
 
@@ -245,6 +245,6 @@ run_tests
 if [ -z "$testrargs" ]; then
   if [ $no_pep8 -eq 0 ]; then
     run_pep8
-    bash ./tools/conf/check_uptodate.sh
+    ${wrapper} bash ./tools/conf/check_uptodate.sh
   fi
 fi
diff --git a/tools/conf/check_uptodate.sh b/tools/conf/check_uptodate.sh
index df9bc74c5..bfe199b45 100755
--- a/tools/conf/check_uptodate.sh
+++ b/tools/conf/check_uptodate.sh
@@ -4,7 +4,8 @@ CFGFILE=cinder.conf.sample
 tools/conf/generate_sample.sh -o $TEMPDIR
 if ! diff $TEMPDIR/$CFGFILE etc/cinder/$CFGFILE
 then
-    echo "E: cinder.conf.sample is not up to date, please run tools/conf/generate_sample.sh"
+    echo "E: cinder.conf.sample is not up to date, please run tools/conf/generate_sample.sh in venv"
+    echo "E: e.g. \$ source .venv/bin/activate; tools/conf/generate_sample.sh"
     rm -rf $TEMPDIR
     exit 42
 fi
-- 
2.45.2