#!/bin/bash
#-----------------
# Testing nova-api
#-----------------
set -e
DAEMONS=('nova-api' 'nova-api-metadata')

for daemon in "${DAEMONS[@]}"; do
    apt-get install -y $daemon 2>&1 > /dev/null

    if apache2ctl -t -D DUMP_VHOSTS | grep -q $daemon.conf; then
        echo "OK"
    else
        echo "ERROR: ${daemon} IS NOT RUNNING"
        exit 1
    fi

    apt-get remove -y $daemon 2>&1 > /dev/null
done
