diff options
author | Tim Rozet <trozet@redhat.com> | 2015-07-14 17:41:06 -0400 |
---|---|---|
committer | Tim Rozet <trozet@redhat.com> | 2015-07-14 17:41:06 -0400 |
commit | 3c085628e74362805ec5aebe7a2c0c0c85a4ee25 (patch) | |
tree | f26a5489a8a4cd00648b9273e9665a910e498e5f /foreman/ci | |
parent | 0174fdf6cbb16394eb8f57d8b421341b5f39bf36 (diff) |
Fixes clean bug where $vm_dir is assumed to exist
JIRA: BGS-60
Change-Id: Ida9458cf638eca81e6a3d67941203c605d9e4a8a
Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'foreman/ci')
-rwxr-xr-x | foreman/ci/clean.sh | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/foreman/ci/clean.sh b/foreman/ci/clean.sh index 05c35fc..0dc34ed 100755 --- a/foreman/ci/clean.sh +++ b/foreman/ci/clean.sh @@ -118,17 +118,19 @@ fi ###destroy vagrant if [ $skip_vagrant -eq 0 ]; then - cd $vm_dir/foreman_vm - if vagrant destroy -f; then - echo "${blue}Successfully destroyed Foreman VM ${reset}" - else - echo "${red}Unable to destroy Foreman VM ${reset}" - echo "${blue}Checking if vagrant was already destroyed and no process is active...${reset}" - if ps axf | grep vagrant; then - echo "${red}Vagrant VM still exists...exiting ${reset}" - exit 1 + if [ -d $vm_dir/foreman_vm ]; then + cd $vm_dir/foreman_vm + if vagrant destroy -f; then + echo "${blue}Successfully destroyed Foreman VM ${reset}" else - echo "${blue}Vagrant process doesn't exist. Moving on... ${reset}" + echo "${red}Unable to destroy Foreman VM ${reset}" + echo "${blue}Checking if vagrant was already destroyed and no process is active...${reset}" + if ps axf | grep vagrant; then + echo "${red}Vagrant VM still exists...exiting ${reset}" + exit 1 + else + echo "${blue}Vagrant process doesn't exist. Moving on... ${reset}" + fi fi fi |