Fixes issue with deploy copying from /tmp and clean bailing early 78/1378/1
authorTim Rozet <trozet@redhat.com>
Tue, 1 Sep 2015 20:41:28 +0000 (16:41 -0400)
committerTim Rozet <trozet@redhat.com>
Tue, 1 Sep 2015 20:41:28 +0000 (16:41 -0400)
deploy.sh was failing in user deployments because the necessary puppet
modules and vagrant files were being copied accidentally from /tmp and
not the script directory.  This patch fixes that issue.  clean.sh was
failing checks to see if vagrant or virtualbox was still running, due to
a bug with checking "ps" and using grep.  This patch resolves that.

JIRA: APEX-16,APEX-17

Change-Id: I1faa6fc134c0308acb2e7b14be30f7cd3c99d109
Signed-off-by: Tim Rozet <trozet@redhat.com>
foreman/ci/clean.sh
foreman/ci/deploy.sh

index 1bd1713..345864b 100755 (executable)
@@ -128,7 +128,7 @@ if [ $skip_vagrant -eq 0 ]; then
         echo "${red}Unable to destroy $vm Vagrant VM! Attempting to killall vagrant if process is hung ${reset}"
         killall vagrant
         echo "${blue}Checking if vagrant was already destroyed and no process is active...${reset}"
-        if ps axf | grep vagrant; then
+        if ps axf | grep vagrant | grep -v 'grep'; then
           echo "${red}Vagrant process still exists after kill...exiting ${reset}"
           exit 1
         else
@@ -158,13 +158,13 @@ if [ $skip_vagrant -eq 0 ]; then
 
   echo "${blue}Checking for any remaining virtual box processes...${reset}"
   ###kill virtualbox
-  if ps axf | grep virtualbox; then
+  if ps axf | grep virtualbox | grep -v 'grep'; then
     echo "${blue}virtualbox processes are still running. Killing any remaining VirtualBox processes...${reset}"
     killall virtualbox
   fi
 
   ###kill any leftover VMs (brute force)
-  if ps axf | grep VBoxHeadless; then
+  if ps axf | grep VBoxHeadless | grep -v 'grep'; then
     echo "${blue}VBoxHeadless processes are still running. Killing any remaining VBoxHeadless processes...${reset}"
     killall VBoxHeadless
   fi
index 9c1447b..50a9dcf 100755 (executable)
@@ -30,6 +30,7 @@ declare -A admin_ip_arr
 declare -A public_ip_arr
 
 vm_dir=/var/opt/opnfv
+script=`realpath $0`
 ##END VARS
 
 ##FUNCTIONS
@@ -479,7 +480,6 @@ clean_tmp() {
 ##params: destination directory
 ##usage: clone_bgs /tmp/myvm/
 clone_bgs() {
-  script=`realpath $0`
   script_dir="`dirname "$script"`"
   cp -fr $script_dir/ $1
   cp -fr $script_dir/../../common/puppet-opnfv $1
@@ -993,7 +993,6 @@ start_virtual_nodes() {
     compute_wait_completed=false
 
     for node in ${nodes}; do
-      cd /tmp/
 
       ##remove VM nodes incase it wasn't cleaned up
       rm -rf $vm_dir/$node