From 37a5c7867324982f2269e2b9b03388807911a576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Iranzo=20G=C3=B3mez?= Date: Thu, 30 Aug 2018 00:26:49 +0200 Subject: [PATCH] Fix formatting options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix tabs<->spaces and other bashate complains Change mode to +x to scripts missing it Force shell to be /bin/bash for compatibility Change-Id: Ied5979f2d886c15b273956a9828d9e0484368bab Signed-off-by: Pablo Iranzo Gómez --- healthcheck/README.md | 10 +-- healthcheck/aodh-api | 2 +- healthcheck/aodh-evaluator | 8 +- healthcheck/aodh-listener | 8 +- healthcheck/aodh-notifier | 8 +- healthcheck/barbican-api | 2 +- healthcheck/barbican-keystone-listener | 8 +- healthcheck/barbican-worker | 8 +- healthcheck/ceilometer-agent-central | 8 +- healthcheck/ceilometer-agent-compute | 8 +- healthcheck/ceilometer-agent-ipmi | 8 +- healthcheck/ceilometer-agent-notification | 8 +- healthcheck/cinder-api | 2 +- healthcheck/cinder-backup | 8 +- healthcheck/cinder-scheduler | 8 +- healthcheck/cinder-volume | 8 +- healthcheck/common.sh | 97 ++++++++++++----------- healthcheck/fluentd | 2 +- healthcheck/glance-api | 4 +- healthcheck/gnocchi-api | 2 +- healthcheck/gnocchi-metricd | 8 +- healthcheck/gnocchi-statsd | 4 +- healthcheck/heat-api | 2 +- healthcheck/heat-api-cfn | 2 +- healthcheck/heat-engine | 8 +- healthcheck/horizon | 6 +- healthcheck/ironic-api | 2 +- healthcheck/ironic-conductor | 8 +- healthcheck/ironic-pxe | 18 ++--- healthcheck/keystone-admin | 2 +- healthcheck/keystone-public | 2 +- healthcheck/manila-scheduler | 8 +- healthcheck/mariadb | 14 ++-- healthcheck/memcached | 2 +- healthcheck/mistral-api | 2 +- healthcheck/mistral-engine | 8 +- healthcheck/mistral-event-engine | 8 +- healthcheck/mistral-executor | 8 +- healthcheck/neutron-api | 4 +- healthcheck/neutron-dhcp | 8 +- healthcheck/neutron-l3 | 8 +- healthcheck/neutron-metadata | 8 +- healthcheck/neutron-ovs-agent | 8 +- healthcheck/neutron-sriov-agent | 8 +- healthcheck/nova-api | 10 +-- healthcheck/nova-compute | 22 ++--- healthcheck/nova-conductor | 8 +- healthcheck/nova-consoleauth | 8 +- healthcheck/nova-ironic | 8 +- healthcheck/nova-libvirt | 2 +- healthcheck/nova-metadata | 2 +- healthcheck/nova-placement | 2 +- healthcheck/nova-scheduler | 8 +- healthcheck/nova-vnc-proxy | 2 +- healthcheck/octavia-api | 4 +- healthcheck/octavia-health-manager | 8 +- healthcheck/octavia-housekeeping | 8 +- healthcheck/octavia-worker | 8 +- healthcheck/opendaylight-api | 4 +- healthcheck/ovn-controller | 8 +- healthcheck/ovn-dbs | 8 +- healthcheck/ovn-metadata | 8 +- healthcheck/panko-api | 2 +- healthcheck/rabbitmq | 2 +- healthcheck/redis | 20 ++--- healthcheck/sahara-engine | 8 +- healthcheck/sensu-client | 8 +- healthcheck/swift-account-server | 4 +- healthcheck/swift-container-server | 4 +- healthcheck/swift-object-server | 10 +-- healthcheck/swift-proxy | 8 +- healthcheck/swift-rsync | 8 +- healthcheck/tacker | 4 +- 73 files changed, 290 insertions(+), 289 deletions(-) mode change 100644 => 100755 healthcheck/common.sh mode change 100644 => 100755 healthcheck/ovn-controller mode change 100644 => 100755 healthcheck/ovn-dbs diff --git a/healthcheck/README.md b/healthcheck/README.md index a8a083900..6e4346405 100644 --- a/healthcheck/README.md +++ b/healthcheck/README.md @@ -1,7 +1,7 @@ # Health check commands The scripts in this directory are meant to implement the -[container-healthcheck][] blueprint. They are written to be compatible +[container-healthcheck][] blueprint. They are written to be compatible with the Docker [HEALTHCHECK][] api. [container-healthcheck]: https://blueprints.launchpad.net/tripleo/+spec/container-healthchecks @@ -12,7 +12,7 @@ The scripts expect to source want to run scripts without installing to that file, you can set the `HEALTHCHECKS_DIR` environment variable, e.g: - $ export HEALTHCHECKS_DIR=$PWD - $ ./heat-api - {"versions": [{"status": "CURRENT", "id": "v1.0", "links": [{"href": "http://192.168.24.1:8004/v1/", "rel": "self"}]}]} - 300 192.168.24.1:8004 0.002 seconds + $ export HEALTHCHECKS_DIR=$PWD + $ ./heat-api + {"versions": [{"status": "CURRENT", "id": "v1.0", "links": [{"href": "http://192.168.24.1:8004/v1/", "rel": "self"}]}]} + 300 192.168.24.1:8004 0.002 seconds diff --git a/healthcheck/aodh-api b/healthcheck/aodh-api index 30df4f8b2..50acf5914 100755 --- a/healthcheck/aodh-api +++ b/healthcheck/aodh-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/aodh-evaluator b/healthcheck/aodh-evaluator index 9348e6a21..74dc4e017 100755 --- a/healthcheck/aodh-evaluator +++ b/healthcheck/aodh-evaluator @@ -6,9 +6,9 @@ process='aodh-evaluator' args="${@:-6379}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened Redis ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened Redis ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/aodh-listener b/healthcheck/aodh-listener index edb8d5d12..0fe940626 100755 --- a/healthcheck/aodh-listener +++ b/healthcheck/aodh-listener @@ -6,9 +6,9 @@ process='aodh-listener' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/aodh-notifier b/healthcheck/aodh-notifier index fc4a845d2..aaf4c89bc 100755 --- a/healthcheck/aodh-notifier +++ b/healthcheck/aodh-notifier @@ -6,9 +6,9 @@ process='aodh-notifier' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/barbican-api b/healthcheck/barbican-api index d89d2069b..f872c3f7f 100755 --- a/healthcheck/barbican-api +++ b/healthcheck/barbican-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/barbican-keystone-listener b/healthcheck/barbican-keystone-listener index bbb6553a7..e2bf2d852 100755 --- a/healthcheck/barbican-keystone-listener +++ b/healthcheck/barbican-keystone-listener @@ -6,9 +6,9 @@ process='barbican-keystone-listener' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/barbican-worker b/healthcheck/barbican-worker index 62e9e4dee..72fd7542f 100755 --- a/healthcheck/barbican-worker +++ b/healthcheck/barbican-worker @@ -6,9 +6,9 @@ process='barbican-worker' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/ceilometer-agent-central b/healthcheck/ceilometer-agent-central index 740930818..1fdc78d28 100755 --- a/healthcheck/ceilometer-agent-central +++ b/healthcheck/ceilometer-agent-central @@ -6,9 +6,9 @@ process='ceilometer-polling' args="${@:-6379}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened Redis ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened Redis ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/ceilometer-agent-compute b/healthcheck/ceilometer-agent-compute index e1425f745..771a63c36 100755 --- a/healthcheck/ceilometer-agent-compute +++ b/healthcheck/ceilometer-agent-compute @@ -6,9 +6,9 @@ process='ceilometer-polling' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/ceilometer-agent-ipmi b/healthcheck/ceilometer-agent-ipmi index 740930818..1fdc78d28 100755 --- a/healthcheck/ceilometer-agent-ipmi +++ b/healthcheck/ceilometer-agent-ipmi @@ -6,9 +6,9 @@ process='ceilometer-polling' args="${@:-6379}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened Redis ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened Redis ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/ceilometer-agent-notification b/healthcheck/ceilometer-agent-notification index f456e60b7..6495b39ab 100755 --- a/healthcheck/ceilometer-agent-notification +++ b/healthcheck/ceilometer-agent-notification @@ -6,9 +6,9 @@ process='ceilometer-agent-notification' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/cinder-api b/healthcheck/cinder-api index 093404e6f..65cae6a46 100755 --- a/healthcheck/cinder-api +++ b/healthcheck/cinder-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/cinder-backup b/healthcheck/cinder-backup index 9c7a15d31..315854d71 100755 --- a/healthcheck/cinder-backup +++ b/healthcheck/cinder-backup @@ -6,9 +6,9 @@ process='cinder-backup' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/cinder-scheduler b/healthcheck/cinder-scheduler index 86fb99899..e3d381334 100755 --- a/healthcheck/cinder-scheduler +++ b/healthcheck/cinder-scheduler @@ -6,9 +6,9 @@ process='cinder-scheduler' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/cinder-volume b/healthcheck/cinder-volume index a0e371a35..5798fdbb5 100755 --- a/healthcheck/cinder-volume +++ b/healthcheck/cinder-volume @@ -6,9 +6,9 @@ process='cinder-volume' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/common.sh b/healthcheck/common.sh old mode 100644 new mode 100755 index 4df7c57b7..101fcaa9f --- a/healthcheck/common.sh +++ b/healthcheck/common.sh @@ -1,55 +1,56 @@ +#!/bin/bash : ${HEALTHCHECK_CURL_MAX_TIME:=10} : ${HEALTHCHECK_CURL_USER_AGENT:=curl-healthcheck} : ${HEALTHCHECK_CURL_WRITE_OUT:='\n%{http_code} %{remote_ip}:%{remote_port} %{time_total} seconds\n'} healthcheck_curl () { - curl -g -k -q --fail \ - --max-time "${HEALTHCHECK_CURL_MAX_TIME}" \ - --user-agent "${HEALTHCHECK_CURL_USER_AGENT}" \ - --write-out "${HEALTHCHECK_CURL_WRITE_OUT}" \ - "$@" || return 1 + curl -g -k -q --fail \ + --max-time "${HEALTHCHECK_CURL_MAX_TIME}" \ + --user-agent "${HEALTHCHECK_CURL_USER_AGENT}" \ + --write-out "${HEALTHCHECK_CURL_WRITE_OUT}" \ + "$@" || return 1 } healthcheck_port () { - process=$1 + process=$1 - # ss truncate command name to 15 characters and this behaviour - # cannot be disabled - if [ ${#process} -gt 15 ] ; then - process=${process:0:15} - fi + # ss truncate command name to 15 characters and this behaviour + # cannot be disabled + if [ ${#process} -gt 15 ] ; then + process=${process:0:15} + fi - shift 1 - args=$@ - ports=${args// /|} - ss -ntp | awk '{print $5,"-",$6}' | egrep ":($ports)" | grep "$process" + shift 1 + args=$@ + ports=${args// /|} + ss -ntp | awk '{print $5,"-",$6}' | egrep ":($ports)" | grep "$process" } healthcheck_listen () { - process=$1 + process=$1 - # ss truncate command name to 15 characters and this behaviour - # cannot be disabled - if [ ${#process} -gt 15 ] ; then - process=${process:0:15} - fi + # ss truncate command name to 15 characters and this behaviour + # cannot be disabled + if [ ${#process} -gt 15 ] ; then + process=${process:0:15} + fi - shift 1 - args=$@ - ports=${args// /|} - ss -lnp | awk '{print $5,"-",$7}' | egrep ":($ports)" | grep "$process" + shift 1 + args=$@ + ports=${args// /|} + ss -lnp | awk '{print $5,"-",$7}' | egrep ":($ports)" | grep "$process" } healthcheck_socket () { - process=$1 - socket=$2 + process=$1 + socket=$2 - # lsof truncate command name to 15 characters and this behaviour - # cannot be disabled - if [ ${#process} -gt 15 ] ; then - process=${process:0:15} - fi - lsof -Fc -Ua $socket | grep "c$process" + # lsof truncate command name to 15 characters and this behaviour + # cannot be disabled + if [ ${#process} -gt 15 ] ; then + process=${process:0:15} + fi + lsof -Fc -Ua $socket | grep "c$process" } healthcheck_file_modification () { @@ -60,27 +61,27 @@ healthcheck_file_modification () { last_mod=$(stat -c '%Y' $file_path) limit_epoch=$(( curr_time-limit_seconds )) if [ "$limit_epoch" -gt "$last_mod" ]; then - return 1 + return 1 fi } get_config_val () { - crudini --get "$1" "$2" "$3" 2> /dev/null || echo "$4" + crudini --get "$1" "$2" "$3" 2> /dev/null || echo "$4" } # apachectl -S is slightly harder to parse and doesn't say if the vhost is serving SSL get_url_from_vhost () { - vhost_file=$1 - server_name=$(awk '/ServerName/ {print $2}' $vhost_file) - ssl_enabled=$(awk '/SSLEngine/ {print $2}' $vhost_file) - bind_port=$(grep -h "" $vhost_file | sed 's//\1/') - wsgi_alias=$(awk '/WSGIScriptAlias/ {print $2}' $vhost_file) - proto=http - if [[ $ssl_enabled == "on" ]]; then - proto=https - fi - if [[ $wsgi_alias != "/" ]]; then - wsgi_alias="${wsgi_alias}/" - fi - echo ${proto}://${server_name}:${bind_port}${wsgi_alias} + vhost_file=$1 + server_name=$(awk '/ServerName/ {print $2}' $vhost_file) + ssl_enabled=$(awk '/SSLEngine/ {print $2}' $vhost_file) + bind_port=$(grep -h "" $vhost_file | sed 's//\1/') + wsgi_alias=$(awk '/WSGIScriptAlias/ {print $2}' $vhost_file) + proto=http + if [[ $ssl_enabled == "on" ]]; then + proto=https + fi + if [[ $wsgi_alias != "/" ]]; then + wsgi_alias="${wsgi_alias}/" + fi + echo ${proto}://${server_name}:${bind_port}${wsgi_alias} } diff --git a/healthcheck/fluentd b/healthcheck/fluentd index bec376ff8..e42ed3d48 100755 --- a/healthcheck/fluentd +++ b/healthcheck/fluentd @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/glance-api b/healthcheck/glance-api index 37a470c29..13b813376 100755 --- a/healthcheck/glance-api +++ b/healthcheck/glance-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh @@ -6,7 +6,7 @@ bind_host=$(get_config_val /etc/glance/glance-api.conf DEFAULT bind_host 127.0.0 bind_port=$(get_config_val /etc/glance/glance-api.conf DEFAULT bind_port 9292) # Add brackets if IPv6 if [[ $bind_host =~ ":" ]]; then - bind_host="[${bind_host}]" + bind_host="[${bind_host}]" fi # glance-api is still eventlet healthcheck_curl http://${bind_host}:${bind_port}/ diff --git a/healthcheck/gnocchi-api b/healthcheck/gnocchi-api index 38f4508ec..b07b17b6f 100755 --- a/healthcheck/gnocchi-api +++ b/healthcheck/gnocchi-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/gnocchi-metricd b/healthcheck/gnocchi-metricd index 282ad9bd1..5f18e4944 100755 --- a/healthcheck/gnocchi-metricd +++ b/healthcheck/gnocchi-metricd @@ -6,9 +6,9 @@ process='gnocchi-metricd' args="${@:-6379}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened Redis ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened Redis ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/gnocchi-statsd b/healthcheck/gnocchi-statsd index 845343efd..10b04d26a 100755 --- a/healthcheck/gnocchi-statsd +++ b/healthcheck/gnocchi-statsd @@ -6,6 +6,6 @@ process='gnocchi-statsd' bind_port=$(get_config_val /etc/gnocchi/gnocchi.conf statsd port 8125) if ! healthcheck_listen $process $bind_port; then - echo "There is no $process process listening on ports $bind_port in the container." - exit 1 + echo "There is no $process process listening on ports $bind_port in the container." + exit 1 fi diff --git a/healthcheck/heat-api b/healthcheck/heat-api index d4463339e..fa9ea526d 100755 --- a/healthcheck/heat-api +++ b/healthcheck/heat-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/heat-api-cfn b/healthcheck/heat-api-cfn index 0e553a338..a5188189f 100755 --- a/healthcheck/heat-api-cfn +++ b/healthcheck/heat-api-cfn @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/heat-engine b/healthcheck/heat-engine index 77d9a1b1c..6381fc3d1 100755 --- a/healthcheck/heat-engine +++ b/healthcheck/heat-engine @@ -6,9 +6,9 @@ process='heat-engine' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/horizon b/healthcheck/horizon index 816785062..7225fac87 100755 --- a/healthcheck/horizon +++ b/healthcheck/horizon @@ -1,10 +1,10 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh check_url=$(get_url_from_vhost /etc/httpd/conf.d/10-horizon_vhost.conf) if healthcheck_curl ${check_url}; then - exit 0 + exit 0 else - healthcheck_curl $(get_url_from_vhost /etc/httpd/conf.d/10-horizon_ssl_vhost.conf) + healthcheck_curl $(get_url_from_vhost /etc/httpd/conf.d/10-horizon_ssl_vhost.conf) fi diff --git a/healthcheck/ironic-api b/healthcheck/ironic-api index cb617c5ae..b0df8c8dc 100755 --- a/healthcheck/ironic-api +++ b/healthcheck/ironic-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/ironic-conductor b/healthcheck/ironic-conductor index ce48aa99b..97b63e0e0 100755 --- a/healthcheck/ironic-conductor +++ b/healthcheck/ironic-conductor @@ -6,9 +6,9 @@ process='ironic-conductor' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/ironic-pxe b/healthcheck/ironic-pxe index b5e4efdad..2a9a172c9 100755 --- a/healthcheck/ironic-pxe +++ b/healthcheck/ironic-pxe @@ -1,16 +1,16 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh if grep "/httpd " /run_command ; then - bind_host=127.0.0.1 - bind_port=$(grep "^Listen " /etc/httpd/conf.d/10-ipxe_vhost.conf | awk '{print $2}') - protocol=http - path= + bind_host=127.0.0.1 + bind_port=$(grep "^Listen " /etc/httpd/conf.d/10-ipxe_vhost.conf | awk '{print $2}') + protocol=http + path= else - bind_host=$(ps -ef | grep -oe '--address \([0-9]\+\.\?\)\+' | awk '{print $2}') - bind_port=69 - protocol=tftp - path=map-file + bind_host=$(ps -ef | grep -oe '--address \([0-9]\+\.\?\)\+' | awk '{print $2}') + bind_port=69 + protocol=tftp + path=map-file fi healthcheck_curl ${protocol}://${bind_host}:${bind_port}/${path} diff --git a/healthcheck/keystone-admin b/healthcheck/keystone-admin index 314126088..72334bade 100755 --- a/healthcheck/keystone-admin +++ b/healthcheck/keystone-admin @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/keystone-public b/healthcheck/keystone-public index 2bf07146f..bfd4d7a06 100755 --- a/healthcheck/keystone-public +++ b/healthcheck/keystone-public @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/manila-scheduler b/healthcheck/manila-scheduler index f1e0b17da..7d5cc5659 100755 --- a/healthcheck/manila-scheduler +++ b/healthcheck/manila-scheduler @@ -6,9 +6,9 @@ process='manila-scheduler' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/mariadb b/healthcheck/mariadb index 5fd9ecce9..2cb31f898 100755 --- a/healthcheck/mariadb +++ b/healthcheck/mariadb @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh GALERA_XINETD_CONF='/etc/xinetd.d/galera-monitor' @@ -6,11 +6,11 @@ GALERA_XINETD_CONF='/etc/xinetd.d/galera-monitor' # If the mariadb container is running xinetd with galera-monitor then it is a # clustercheck container, otherwise a mysql/mariadb one if pgrep xinetd &> /dev/null && grep -qe 'disable.*no' $GALERA_XINETD_CONF; then - PORT=$(awk '/port.*=/{ print $3 }' $GALERA_XINETD_CONF) - ADDR=$(awk '/bind.*=/{ print $3 }' $GALERA_XINETD_CONF) - bind_host=${ADDR:-$(hostname)} - bind_port=${PORT:-9200} - healthcheck_curl http://${bind_host}:${bind_port}/ + PORT=$(awk '/port.*=/{ print $3 }' $GALERA_XINETD_CONF) + ADDR=$(awk '/bind.*=/{ print $3 }' $GALERA_XINETD_CONF) + bind_host=${ADDR:-$(hostname)} + bind_port=${PORT:-9200} + healthcheck_curl http://${bind_host}:${bind_port}/ else - mysql -e 'select 1' || exit 1 + mysql -e 'select 1' || exit 1 fi diff --git a/healthcheck/memcached b/healthcheck/memcached index 63ee11ad7..98ed2f07a 100755 --- a/healthcheck/memcached +++ b/healthcheck/memcached @@ -4,7 +4,7 @@ listen_addr=$(awk 'match($0, /-l +([0-9a-fA-F\.\:]+) /, a) {print a[1]}' /etc/sy # Add brackets if IPv6 if [[ $listen_addr =~ ":" ]]; then - listen_addr="[${listen_addr}]" + listen_addr="[${listen_addr}]" fi echo "stats" | socat - TCP:$listen_addr:11211 diff --git a/healthcheck/mistral-api b/healthcheck/mistral-api index 48e938213..89b1c55e2 100755 --- a/healthcheck/mistral-api +++ b/healthcheck/mistral-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/mistral-engine b/healthcheck/mistral-engine index d51538a42..1d94f9444 100755 --- a/healthcheck/mistral-engine +++ b/healthcheck/mistral-engine @@ -6,9 +6,9 @@ process='mistral-server' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/mistral-event-engine b/healthcheck/mistral-event-engine index d51538a42..1d94f9444 100755 --- a/healthcheck/mistral-event-engine +++ b/healthcheck/mistral-event-engine @@ -6,9 +6,9 @@ process='mistral-server' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/mistral-executor b/healthcheck/mistral-executor index d51538a42..1d94f9444 100755 --- a/healthcheck/mistral-executor +++ b/healthcheck/mistral-executor @@ -6,9 +6,9 @@ process='mistral-server' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/neutron-api b/healthcheck/neutron-api index e626a6726..49a92582e 100755 --- a/healthcheck/neutron-api +++ b/healthcheck/neutron-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh @@ -7,7 +7,7 @@ bind_port=$(get_config_val /etc/neutron/neutron.conf DEFAULT bind_port 9696) # Add brackets if IPv6 if [[ $bind_host =~ ":" ]]; then - bind_host="[${bind_host}]" + bind_host="[${bind_host}]" fi healthcheck_curl http://${bind_host}:${bind_port}/ diff --git a/healthcheck/neutron-dhcp b/healthcheck/neutron-dhcp index cd589d72a..8825be6da 100755 --- a/healthcheck/neutron-dhcp +++ b/healthcheck/neutron-dhcp @@ -6,9 +6,9 @@ process='neutron-dhcp-agent' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/neutron-l3 b/healthcheck/neutron-l3 index 084104be5..0d39ffedf 100755 --- a/healthcheck/neutron-l3 +++ b/healthcheck/neutron-l3 @@ -6,9 +6,9 @@ process='neutron-l3-agent' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/neutron-metadata b/healthcheck/neutron-metadata index 07547c1ae..bc5b0ed8d 100755 --- a/healthcheck/neutron-metadata +++ b/healthcheck/neutron-metadata @@ -6,9 +6,9 @@ process='neutron-metadata-agent' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/neutron-ovs-agent b/healthcheck/neutron-ovs-agent index 86e5b3c00..1e9879b16 100755 --- a/healthcheck/neutron-ovs-agent +++ b/healthcheck/neutron-ovs-agent @@ -6,9 +6,9 @@ process='neutron-openvswitch-agent' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/neutron-sriov-agent b/healthcheck/neutron-sriov-agent index 65f212f21..8de79d4b0 100755 --- a/healthcheck/neutron-sriov-agent +++ b/healthcheck/neutron-sriov-agent @@ -6,9 +6,9 @@ process='neutron-sriov-nic-agent' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process connected via RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process connected via RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/nova-api b/healthcheck/nova-api index 7afb1c753..3413bf21c 100755 --- a/healthcheck/nova-api +++ b/healthcheck/nova-api @@ -1,14 +1,14 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh if ps -e | grep --quiet nova-api-metada; then - bind_host=$(get_config_val /etc/nova/nova.conf DEFAULT metadata_listen 127.0.0.1) - bind_port=$(get_config_val /etc/nova/nova.conf DEFAULT metadata_listen_port 8775) - check_url="http://${bind_host}:${bind_port}/" + bind_host=$(get_config_val /etc/nova/nova.conf DEFAULT metadata_listen 127.0.0.1) + bind_port=$(get_config_val /etc/nova/nova.conf DEFAULT metadata_listen_port 8775) + check_url="http://${bind_host}:${bind_port}/" else - check_url=$(get_url_from_vhost /etc/httpd/conf.d/10-nova_api_wsgi.conf) + check_url=$(get_url_from_vhost /etc/httpd/conf.d/10-nova_api_wsgi.conf) fi healthcheck_curl ${check_url} diff --git a/healthcheck/nova-compute b/healthcheck/nova-compute index 14e4a78b1..f1ca8bfb4 100755 --- a/healthcheck/nova-compute +++ b/healthcheck/nova-compute @@ -3,20 +3,20 @@ . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh if ps -e | grep nova-compute; then - process='nova-compute' - args="${@:-5671 5672}" - test_func='healthcheck_port' - err_msg="There is no $process process with opened RabbitMQ ports (${args// /,}) running in the container" + process='nova-compute' + args="${@:-5671 5672}" + test_func='healthcheck_port' + err_msg="There is no $process process with opened RabbitMQ ports (${args// /,}) running in the container" else - process='sshd' - args="${@:-2022}" - test_func='healthcheck_listen' - err_msg="There is no $process process listening on port(s) ${args// /,} in the container" + process='sshd' + args="${@:-2022}" + test_func='healthcheck_listen' + err_msg="There is no $process process listening on port(s) ${args// /,} in the container" fi if $test_func $process $args; then - exit 0 + exit 0 else - echo $err_msg - exit 1 + echo $err_msg + exit 1 fi diff --git a/healthcheck/nova-conductor b/healthcheck/nova-conductor index c251fd62a..65533dcfb 100755 --- a/healthcheck/nova-conductor +++ b/healthcheck/nova-conductor @@ -6,9 +6,9 @@ process='nova-conductor' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/nova-consoleauth b/healthcheck/nova-consoleauth index 4b453f15c..aa615bb74 100755 --- a/healthcheck/nova-consoleauth +++ b/healthcheck/nova-consoleauth @@ -6,9 +6,9 @@ process='nova-consoleauth' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/nova-ironic b/healthcheck/nova-ironic index 24c412a7a..27a9ec172 100755 --- a/healthcheck/nova-ironic +++ b/healthcheck/nova-ironic @@ -6,9 +6,9 @@ process='nova-compute' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/nova-libvirt b/healthcheck/nova-libvirt index d1b91e738..19ef8e97f 100755 --- a/healthcheck/nova-libvirt +++ b/healthcheck/nova-libvirt @@ -1,3 +1,3 @@ -#!/bin/sh +#!/bin/bash virsh version --daemon diff --git a/healthcheck/nova-metadata b/healthcheck/nova-metadata index f0cd2e1ec..785423a84 100755 --- a/healthcheck/nova-metadata +++ b/healthcheck/nova-metadata @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/nova-placement b/healthcheck/nova-placement index 1e54c93e9..ef0e05fe6 100755 --- a/healthcheck/nova-placement +++ b/healthcheck/nova-placement @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/nova-scheduler b/healthcheck/nova-scheduler index 602fa6d71..e27c30669 100755 --- a/healthcheck/nova-scheduler +++ b/healthcheck/nova-scheduler @@ -6,9 +6,9 @@ process='nova-scheduler' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/nova-vnc-proxy b/healthcheck/nova-vnc-proxy index 631075134..d56257817 100755 --- a/healthcheck/nova-vnc-proxy +++ b/healthcheck/nova-vnc-proxy @@ -9,7 +9,7 @@ proto_is_ssl=$(get_config_val /etc/nova/nova.conf DEFAULT ssl_only false) bind_proto=http if [ "${proto_is_ssl,,}" = true ] ; then - bind_proto=https + bind_proto=https fi healthcheck_curl ${bind_proto}://${bind_host}:${bind_port}/ diff --git a/healthcheck/octavia-api b/healthcheck/octavia-api index 4b619e24b..20f78bd2e 100755 --- a/healthcheck/octavia-api +++ b/healthcheck/octavia-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh @@ -7,7 +7,7 @@ bind_port=$(get_config_val /etc/octavia/octavia.conf api_settings bind_port 9876 # Add brackets if IPv6 if [[ $bind_host =~ ":" ]]; then - bind_host="[${bind_host}]" + bind_host="[${bind_host}]" fi healthcheck_curl http://${bind_host}:${bind_port}/ diff --git a/healthcheck/octavia-health-manager b/healthcheck/octavia-health-manager index 80aa9b41c..3e0ca95ef 100755 --- a/healthcheck/octavia-health-manager +++ b/healthcheck/octavia-health-manager @@ -6,9 +6,9 @@ process='octavia-health-manager' args="${@:-5555}" if healthcheck_listen $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process listening on ports $ports." - exit 1 + ports=${args// /,} + echo "There is no $process process listening on ports $ports." + exit 1 fi diff --git a/healthcheck/octavia-housekeeping b/healthcheck/octavia-housekeeping index 3d8cdb3a4..84e254b36 100755 --- a/healthcheck/octavia-housekeeping +++ b/healthcheck/octavia-housekeeping @@ -6,9 +6,9 @@ process='octavia-housekeeping' args="${@:-3306}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "Did not find $process process running and connected to MySQL via ports ($ports) in the container." - exit 1 + ports=${args// /,} + echo "Did not find $process process running and connected to MySQL via ports ($ports) in the container." + exit 1 fi diff --git a/healthcheck/octavia-worker b/healthcheck/octavia-worker index 6b2777bd0..2f27b07d1 100755 --- a/healthcheck/octavia-worker +++ b/healthcheck/octavia-worker @@ -6,9 +6,9 @@ process='octavia-worker' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/opendaylight-api b/healthcheck/opendaylight-api index 0e23eedd8..d9477ad1f 100755 --- a/healthcheck/opendaylight-api +++ b/healthcheck/opendaylight-api @@ -6,9 +6,9 @@ file=/opt/opendaylight/etc/org.ops4j.pax.web.cfg bind_host=$(awk -F "= *" '/^org.ops4j.pax.web.listening.addresses/ {print $2}' $file) tls_enabled=$(awk -F "= *" '/^org.osgi.service.http.secure.enabled/ {print $2}' $file) if [[ -z "$tls_enabled" || "$tls_enabled" != "true" ]]; then - bind_port=$(awk -F "= *" '/^org.osgi.service.http.port\s*=/ {print $2}' $file) + bind_port=$(awk -F "= *" '/^org.osgi.service.http.port\s*=/ {print $2}' $file) else - bind_port=$(awk -F "= *" '/^org.osgi.service.http.port.secure/ {print $2}' $file) + bind_port=$(awk -F "= *" '/^org.osgi.service.http.port.secure/ {print $2}' $file) fi healthcheck_curl http://$bind_host:$bind_port/diagstatus diff --git a/healthcheck/ovn-controller b/healthcheck/ovn-controller old mode 100644 new mode 100755 index aa2a005ec..5ddaf0830 --- a/healthcheck/ovn-controller +++ b/healthcheck/ovn-controller @@ -6,9 +6,9 @@ process='ovn-controller' args="${@:-6642}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process connected to ovsdb ports $ports running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process connected to ovsdb ports $ports running in the container" + exit 1 fi diff --git a/healthcheck/ovn-dbs b/healthcheck/ovn-dbs old mode 100644 new mode 100755 index 46b78d84d..54dd3499a --- a/healthcheck/ovn-dbs +++ b/healthcheck/ovn-dbs @@ -6,8 +6,8 @@ process='ovn-northd' sockets="${@:-/run/openvswitch/ovnnb_db.sock /run/openvswitch/ovnsb_db.sock}" for sock in sockets; do - if ! healthcheck_socket $process $sock; then - echo "There is no $process process connected to socket $sock running in the container" - exit 1 - fi + if ! healthcheck_socket $process $sock; then + echo "There is no $process process connected to socket $sock running in the container" + exit 1 + fi done diff --git a/healthcheck/ovn-metadata b/healthcheck/ovn-metadata index a56849ba0..9fe1f2039 100755 --- a/healthcheck/ovn-metadata +++ b/healthcheck/ovn-metadata @@ -6,9 +6,9 @@ process='networking-ovn-metadata-agent' args="${@:-6642}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process connected to ovsdb ports $ports running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process connected to ovsdb ports $ports running in the container" + exit 1 fi diff --git a/healthcheck/panko-api b/healthcheck/panko-api index 451aafc9d..2301a3028 100755 --- a/healthcheck/panko-api +++ b/healthcheck/panko-api @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh diff --git a/healthcheck/rabbitmq b/healthcheck/rabbitmq index ea790df8f..b2c4002d1 100755 --- a/healthcheck/rabbitmq +++ b/healthcheck/rabbitmq @@ -1,3 +1,3 @@ -#!/bin/sh +#!/bin/bash rabbitmqctl node_health_check || exit 1 diff --git a/healthcheck/redis b/healthcheck/redis index cd09e524c..df0f30bfb 100755 --- a/healthcheck/redis +++ b/healthcheck/redis @@ -1,27 +1,27 @@ #!/bin/bash if parse_out=$(cat "/etc/redis.conf" | egrep "^bind +.*$"); then - redis_host=$(echo -n $parse_out | awk '{print $2}') + redis_host=$(echo -n $parse_out | awk '{print $2}') else - redis_host=127.0.0.1 + redis_host=127.0.0.1 fi if parse_out=$(cat "/etc/redis.conf" | egrep "^port +.*$"); then - redis_port=$(echo -n $parse_out | awk '{print $2}') + redis_port=$(echo -n $parse_out | awk '{print $2}') else - redis_port=6379 + redis_port=6379 fi if parse_out=$(cat "/etc/redis.conf" | egrep "^requirepass +.*$"); then - redis_pass=$(echo -n $parse_out | awk '{print $2}') - result=$(printf "*2\r\n\$4\r\nAUTH\r\n\$${#redis_pass}\r\n${redis_pass}\r\n*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port) + redis_pass=$(echo -n $parse_out | awk '{print $2}') + result=$(printf "*2\r\n\$4\r\nAUTH\r\n\$${#redis_pass}\r\n${redis_pass}\r\n*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port) else - result=$(printf "*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port) + result=$(printf "*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port) fi if echo $result | grep -q '+PONG'; then - echo "Redis server responded correctly on ${redis_host}:${redis_port}." + echo "Redis server responded correctly on ${redis_host}:${redis_port}." else - echo "Redis server does not respond correctly: ${result}" - exit 1 + echo "Redis server does not respond correctly: ${result}" + exit 1 fi diff --git a/healthcheck/sahara-engine b/healthcheck/sahara-engine index f22eb7981..18d50734b 100755 --- a/healthcheck/sahara-engine +++ b/healthcheck/sahara-engine @@ -6,9 +6,9 @@ process='sahara-engine' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/sensu-client b/healthcheck/sensu-client index cfcbc8a5c..386faac0f 100755 --- a/healthcheck/sensu-client +++ b/healthcheck/sensu-client @@ -6,9 +6,9 @@ process='sensu-client' args="${@:-5671 5672}" if healthcheck_port $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" - exit 1 + ports=${args// /,} + echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container" + exit 1 fi diff --git a/healthcheck/swift-account-server b/healthcheck/swift-account-server index 8762604ce..1ef7f05ec 100755 --- a/healthcheck/swift-account-server +++ b/healthcheck/swift-account-server @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh @@ -16,7 +16,7 @@ if ps -e | grep --quiet swift-account-server; then bind_port=$(get_config_val $conf DEFAULT bind_port 6002) # Add brackets if IPv6 if [[ $bind_host =~ ":" ]]; then - bind_host="[${bind_host}]" + bind_host="[${bind_host}]" fi healthcheck_curl http://${bind_host}:${bind_port}/healthcheck else diff --git a/healthcheck/swift-container-server b/healthcheck/swift-container-server index c9c8cba89..a1fdcb952 100755 --- a/healthcheck/swift-container-server +++ b/healthcheck/swift-container-server @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh @@ -16,7 +16,7 @@ if ps -e | grep --quiet swift-container-server; then bind_port=$(get_config_val $conf DEFAULT bind_port 6001) # Add brackets if IPv6 if [[ $bind_host =~ ":" ]]; then - bind_host="[${bind_host}]" + bind_host="[${bind_host}]" fi healthcheck_curl http://${bind_host}:${bind_port}/healthcheck else diff --git a/healthcheck/swift-object-server b/healthcheck/swift-object-server index b9f618a4d..e0cee668d 100755 --- a/healthcheck/swift-object-server +++ b/healthcheck/swift-object-server @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh @@ -16,7 +16,7 @@ if ps -e | grep --quiet swift-object-server; then bind_port=$(get_config_val $conf DEFAULT bind_port 6000) # Add brackets if IPv6 if [[ $bind_host =~ ":" ]]; then - bind_host="[${bind_host}]" + bind_host="[${bind_host}]" fi healthcheck_curl http://${bind_host}:${bind_port}/healthcheck elif ps -e | grep --quiet rsync; then @@ -24,9 +24,9 @@ elif ps -e | grep --quiet rsync; then args="${@:-873}" if ! healthcheck_listen $process $args; then - ports=${args// /,} - echo "There is no $process process, listening on port(s) $ports, running in the container." - exit 1 + ports=${args// /,} + echo "There is no $process process, listening on port(s) $ports, running in the container." + exit 1 fi else if ps -e | grep --quiet swift-account-auditor; then diff --git a/healthcheck/swift-proxy b/healthcheck/swift-proxy index 6b9df0a2d..19ca60219 100755 --- a/healthcheck/swift-proxy +++ b/healthcheck/swift-proxy @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh @@ -6,8 +6,8 @@ if ps -e | grep --quiet swift-proxy-server; then conf=/etc/swift/proxy-server.conf if ! crudini --get $conf pipeline:main pipeline | grep -q healthcheck; then - echo "healthcheck is not available" >&2 - exit 0 + echo "healthcheck is not available" >&2 + exit 0 fi # swift-proxy is still eventlet @@ -15,7 +15,7 @@ if ps -e | grep --quiet swift-proxy-server; then bind_port=$(get_config_val $conf DEFAULT bind_port 8080) # Add brackets if IPv6 if [[ $bind_host =~ ":" ]]; then - bind_host="[${bind_host}]" + bind_host="[${bind_host}]" fi healthcheck_curl http://${bind_host}:${bind_port}/healthcheck else diff --git a/healthcheck/swift-rsync b/healthcheck/swift-rsync index 70174d597..ee8d76384 100755 --- a/healthcheck/swift-rsync +++ b/healthcheck/swift-rsync @@ -6,9 +6,9 @@ process='rsync' args="${@:-873}" if healthcheck_listen $process $args; then - exit 0 + exit 0 else - ports=${args// /,} - echo "There is no $process process, listening on port(s) $ports, running in the container." - exit 1 + ports=${args// /,} + echo "There is no $process process, listening on port(s) $ports, running in the container." + exit 1 fi diff --git a/healthcheck/tacker b/healthcheck/tacker index 8003c5c43..bf9bb53c1 100755 --- a/healthcheck/tacker +++ b/healthcheck/tacker @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh @@ -6,7 +6,7 @@ bind_host=$(get_config_val /etc/tacker/tacker.conf DEFAULT bind_host 127.0.0.1) bind_port=$(get_config_val /etc/tacker/tacker.conf DEFAULT bind_port 9890) # Add brackets if IPv6 if [[ $bind_host =~ ":" ]]; then - bind_host="[${bind_host}]" + bind_host="[${bind_host}]" fi healthcheck_curl http://${bind_host}:${bind_port}/