blob: 0cb3e6eab4398da4c2ea5d2221381f97efec6b2b [file] [log] [blame]
Jack Lucas205fc2e2019-03-22 18:31:55 -04001#!/bin/bash
2# ============LICENSE_START=======================================================
3# org.onap.dcae
4# ================================================================================
Schmalzried, Terry (ts862m)15b49792020-08-21 15:59:22 -04005# Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
Jack Lucas205fc2e2019-03-22 18:31:55 -04006# ================================================================================
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#
Schmalzried, Terry (ts862m)15b49792020-08-21 15:59:22 -040044# or:
45#
46# cfy status
47# Retrieving manager services status... [ip=dcae-cloudify-manager]
48#
49# Services:
50# +--------------------------------+--------+
51# | service | status |
52# +--------------------------------+--------+
53# | Cloudify Console | Active |
54# | PostgreSQL | Active |
55# | AMQP-Postgres | Active |
56# | Manager Rest-Service | Active |
57# | RabbitMQ | Active |
58# | Webserver | Active |
59# | Management Worker | Active |
60# +--------------------------------+--------+
61#
62# When an individual service is not running, it will have a status other than "running" or "Active".
Jack Lucas205fc2e2019-03-22 18:31:55 -040063# If the Cloudify API cannot be reached, the "Services:" line will not appear.
64
65STAT=$(cfy status)
66if (echo "${STAT}" | grep "^Services:$")
67then
68 echo "Got a status response"
Schmalzried, Terry (ts862m)15b49792020-08-21 15:59:22 -040069 if !(echo "${STAT}" | egrep '^\| [[:alnum:]]+'| egrep -iv ' Active | running ')
Jack Lucas205fc2e2019-03-22 18:31:55 -040070 then
71 echo "All services running"
72 exit 0
73 else
74 echo "Some service(s) not running"
75 fi
76else
77 echo "Did not get a status response"
78fi
79echo "${STAT}"
80exit 1