metal/mtce-compute/cgts-mtce-compute-1.0/scripts/nova-goenabled.sh
Sun Austin fedb95ba79 Fix linters issues and enable tox/zuul linters job as gate
Fix below linters issues
 E001 Trailing Whitespace
 E003 Indent not multiple of 4
 E006 Line too long
 E011 Then keyword is not on same line as if or elif keyword
 E020 Function declaration not in format ^function name {$
 E040 Syntax error: syntax error near unexpected token `;'

ignore cases are added in tox setup
 E006 Line too long
 E010: do not on the same line as for

Story: 2003368
Task: 24427

Change-Id: I6acf64271a4e608be8bc8fa965cac4fa31e0c05b
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-09-05 09:02:25 +08:00

75 lines
1.5 KiB
Bash

#! /bin/bash
#
# Copyright (c) 2015-2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
### CONFIG_START
#
# Timeout: 300
#
### CONFIG_END
# Platform paths and flags
. /usr/bin/tsconfig
# Linux Standard Base (LSB) Error Codes
SUCCESS=0
GENERIC_ERROR=1
NOVA_GOENABLED_TAG=${NOVA_GOENABLED_TAG:-"NOVA_GOENABLED"}
log()
{
logger -p local1.info -t ${NOVA_GOENABLED_TAG} $@
}
NOVA_RUN="/var/run/nova"
NOVA_INIT_FAILED="${NOVA_RUN}/.nova_init_failed"
NOVA_COMPUTE_ENABLED="${NOVA_RUN}/.nova_compute_enabled"
NOVA_ADVANCE_ENABLED="/var/run/.nova_timer_advance_enabled"
case "$1" in
start)
if [ -e ${VOLATILE_COMPUTE_CONFIG_COMPLETE} ] && [ ! -e ${VOLATILE_DISABLE_COMPUTE_SERVICES} ]; then
log "Start"
if [ -e ${NOVA_INIT_FAILED} ]; then
log "Nova-Init check FAILED"
exit ${GENERIC_ERROR}
fi
log "Nova-Init check PASSED"
while [ true ]; do
if [ -e ${NOVA_ADVANCE_ENABLED} ]; then
log "Nova setup timer advance PASSED"
break
fi
sleep 1
done
while [ true ]; do
if [ -e ${NOVA_COMPUTE_ENABLED} ]; then
log "Nova-Compute service enabled PASSED"
break
fi
sleep 1
done
log "Finished"
fi
;;
stop)
;;
*)
;;
esac
exit ${SUCCESS}