#!/bin/bash


# FUNCTIONS
function purge_ceph {
  docker stop $(docker ps -q)
  rm -rf /var/lib/ceph/*
  rm -rf /etc/ceph
}


# MAIN
purge_ceph

#!/bin/bash


# FUNCTIONS
function purge_ceph {
  container_count=$(docker ps -q | wc -l)

  if [[ "${container_count}" -gt 0 ]]; then
    docker stop $(docker ps -q) || echo failed to stop containers
  fi

  rm -rf /var/lib/ceph/*
  rm -rf /etc/ceph
}


# MAIN
purge_ceph

Fix CI errors caused by container status commands
Fix CI errors caused by container status commands

The docker ps command was returning no containers that caused the docker
stop command to fail. That, combined with the set -e flag from the
caller was causing the purge_cluster.sh script to exit prematurely. This
prevented the purge_cluster.sh script from properly cleaning up previous
ceph configuration files.

Signed-off-by: Ivan Font <d5ef2290306f77a0aabb2bb89953a654042acd12@redhat.com>
