blob: 60b48e62dc65b8dd14a8b46738011e38c27a4f25 [file] [log] [blame]
Jack Lucas205fc2e2019-03-22 18:31:55 -04001#!/bin/bash
2# ============LICENSE_START=======================================================
3# org.onap.dcae
4# ================================================================================
5# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
6# ================================================================================
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18# ============LICENSE_END=========================================================
19#
20# Checking Cloudify Manager readiness by looking
21# for non-running services
22# Relying on the output format of the "cfy status" command.
23# A successful execution of the command outputs:
24#
25# cfy status
26# Retrieving manager services status... [ip=localhost]
27#
28# Services:
29# +--------------------------------+---------+
30# | service | status |
31# +--------------------------------+---------+
32# | InfluxDB | running |
33# | Logstash | running |
34# | AMQP InfluxDB | running |
35# | RabbitMQ | running |
36# | Webserver | running |
37# | Management Worker | running |
38# | PostgreSQL | running |
39# | Cloudify Console | running |
40# | Manager Rest-Service | running |
41# | Riemann | running |
42# +--------------------------------+---------+
43#
44# When an individual service is not running, it will have a status other than "running".
45# If the Cloudify API cannot be reached, the "Services:" line will not appear.
46
47STAT=$(cfy status)
48if (echo "${STAT}" | grep "^Services:$")
49then
50 echo "Got a status response"
51 if !(echo "${STAT}" | egrep '^\| [[:alnum:]]+'| grep -iv '| running ')
52 then
53 echo "All services running"
54 exit 0
55 else
56 echo "Some service(s) not running"
57 fi
58else
59 echo "Did not get a status response"
60fi
61echo "${STAT}"
62exit 1