Merge "Use cat instead of read<file"

This commit is contained in:
Jenkins 2014-03-06 16:24:12 +00:00 committed by Gerrit Code Review
commit 3a07906d90

View File

@ -57,6 +57,18 @@ function configure_nova_hypervisor {
iniset $GLANCE_API_CONF DEFAULT container_formats ami,ari,aki,bare,ovf,docker iniset $GLANCE_API_CONF DEFAULT container_formats ami,ari,aki,bare,ovf,docker
} }
# is_docker_running - Return 0 (true) if Docker is running, otherwise 1
function is_docker_running {
local docker_pid
if [ -f "$DOCKER_PID_FILE" ]; then
docker_pid=$(cat "$DOCKER_PID_FILE")
fi
if [[ -z "$docker_pid" ]] || ! ps -p "$docker_pid" | grep [d]ocker; then
return 1
fi
return 0
}
# install_nova_hypervisor() - Install external components # install_nova_hypervisor() - Install external components
function install_nova_hypervisor { function install_nova_hypervisor {
# So far this is Ubuntu only # So far this is Ubuntu only
@ -69,19 +81,15 @@ function install_nova_hypervisor {
die $LINENO "Docker is not installed. Please run tools/docker/install_docker.sh" die $LINENO "Docker is not installed. Please run tools/docker/install_docker.sh"
fi fi
local docker_pid if ! (is_docker_running); then
read docker_pid <$DOCKER_PID_FILE
if [[ -z $docker_pid ]] || ! ps -p $docker_pid | grep [d]ocker; then
die $LINENO "Docker not running" die $LINENO "Docker not running"
fi fi
} }
# start_nova_hypervisor - Start any required external services # start_nova_hypervisor - Start any required external services
function start_nova_hypervisor { function start_nova_hypervisor {
local docker_pid if ! (is_docker_running); then
read docker_pid <$DOCKER_PID_FILE die $LINENO "Docker not running"
if [[ -z $docker_pid ]] || ! ps -p $docker_pid | grep [d]ocker; then
die $LINENO "Docker not running, start the daemon"
fi fi
# Start the Docker registry container # Start the Docker registry container