Bracket IPv6 address in ironic_inspector healthcheck

When using an IPv6 provisioning address, the address must be
bracketed for the ironic_inspector healthcheck.

In addition clean up other healthchecks to use this common
function when an address is used.

Closes-Bug: #1862845
Change-Id: Ifb67ebebed55e2d883a1e94cb4627f55d3a7383e
This commit is contained in:
Bob Fournier 2020-02-11 17:15:19 -05:00
parent f2f19fdd4c
commit 6c5f479616
15 changed files with 26 additions and 62 deletions

View File

@ -122,3 +122,14 @@ check_swift_interval () {
fi
fi
}
# Wrap an IPv6 address in square brackets if not already wrapped
wrap_ipv6 () {
ip=$1
if [[ $ip =~ ":" ]] && [[ $ip != *\] ]]; then
echo [$ip]
else
echo $ip
fi
}

View File

@ -2,6 +2,6 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
bind_host=$(cat /etc/fluentd/config.d/110-monitoring-agent.conf | grep bind | awk '{print $2}')
bind_host=$(wrap_ipv6 $(cat /etc/fluentd/config.d/110-monitoring-agent.conf | grep bind | awk '{print $2}'))
bind_port=$(cat /etc/fluentd/config.d/110-monitoring-agent.conf | grep port | awk '{print $2}')
healthcheck_curl http://${bind_host}:${bind_port}/api/config.json

View File

@ -2,11 +2,8 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
bind_host=$(get_config_val /etc/glance/glance-api.conf DEFAULT bind_host 127.0.0.1)
bind_host=$(wrap_ipv6 $(get_config_val /etc/glance/glance-api.conf DEFAULT bind_host 127.0.0.1))
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}]"
fi
# glance-api is still eventlet
healthcheck_curl http://${bind_host}:${bind_port}/

View File

@ -17,7 +17,7 @@ if pgrep $process; then
exit 1
fi
else
bind_host=$(get_config_val /etc/ironic-inspector/inspector.conf DEFAULT listen_address 127.0.0.1)
bind_host=$(wrap_ipv6 $(get_config_val /etc/ironic-inspector/inspector.conf DEFAULT listen_address 127.0.0.1))
bind_port=$(get_config_val /etc/ironic-inspector/inspector.conf DEFAULT listen_port 5050)
healthcheck_curl http://${bind_host}:${bind_port}
fi

View File

@ -3,7 +3,7 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
if grep "/httpd " /run_command 2>/dev/null ; then
bind_host=127.0.0.1
bind_host=$(wrap_ipv6 $(get_config_val /etc/ironic/ironic.conf DEFAULT my_ip 127.0.0.1))
bind_port=$(grep "^Listen " /etc/httpd/conf.d/10-ipxe_vhost.conf | awk '{print $2}')
protocol=http
path=

View File

@ -1,11 +1,6 @@
#!/bin/bash
listen_addr=$(awk 'match($0, /-l +([0-9a-fA-F\.\:]+) /, a) {print a[1]}' /etc/sysconfig/memcached)
# Add brackets if IPv6
if [[ $listen_addr =~ ":" ]]; then
listen_addr="[${listen_addr}]"
fi
listen_addr=$(wrap_ipv6 $(awk 'match($0, /-l +([0-9a-fA-F\.\:]+) /, a) {print a[1]}' /etc/sysconfig/memcached))
echo "version" | socat - TCP:$listen_addr:11211 1>/dev/null
exit $?

View File

@ -2,12 +2,7 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
bind_host=$(get_config_val /etc/neutron/neutron.conf DEFAULT bind_host 127.0.0.1)
bind_host=$(wrap_ipv6 $(get_config_val /etc/neutron/neutron.conf DEFAULT bind_host 127.0.0.1))
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}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/

View File

@ -2,7 +2,7 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
bind_host=$(get_config_val /etc/nova/nova.conf vnc novncproxy_host 127.0.0.1)
bind_host=$(wrap_ipv6 $(get_config_val /etc/nova/nova.conf vnc novncproxy_host 127.0.0.1))
bind_port=$(get_config_val /etc/nova/nova.conf vnc novncproxy_port 6080)
proto_is_ssl=$(get_config_val /etc/nova/nova.conf DEFAULT ssl_only false)
@ -12,9 +12,4 @@ if [ "${proto_is_ssl,,}" = true ] ; then
bind_proto=https
fi
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
fi
healthcheck_curl ${bind_proto}://${bind_host}:${bind_port}/

View File

@ -3,7 +3,7 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
file=/opt/opendaylight/etc/org.ops4j.pax.web.cfg
bind_host=$(awk -F "= *" '/^org.ops4j.pax.web.listening.addresses/ {print $2}' $file)
bind_host=$(wrap_ipv6 $(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)
@ -11,9 +11,4 @@ else
bind_port=$(awk -F "= *" '/^org.osgi.service.http.port.secure/ {print $2}' $file)
fi
# Make Healthcheck URL IPv6 compatible
if [[ $bind_host =~ .*:.* ]]; then
bind_host="[${bind_host}]"
fi
healthcheck_curl http://$bind_host:$bind_port/diagstatus

View File

@ -2,11 +2,7 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
bind_host=$(get_config_val /etc/sahara/sahara.conf DEFAULT host 127.0.0.1)
bind_host=$(wrap_ipv6 $(get_config_val /etc/sahara/sahara.conf DEFAULT host 127.0.0.1))
bind_port=$(get_config_val /etc/sahara/sahara.conf DEFAULT port 8386)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
fi
# sahara-api is still eventlet
healthcheck_curl http://${bind_host}:${bind_port}/

View File

@ -12,11 +12,7 @@ if ps -e | grep --quiet swift-account-server; then
fi
# swift-account-server is still eventlet
bind_host=$(get_config_val $conf DEFAULT bind_ip 127.0.0.1)
bind_host=$(wrap_ipv6 $(get_config_val $conf DEFAULT bind_ip 127.0.0.1))
bind_port=$(get_config_val $conf DEFAULT bind_port 6002)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/healthcheck
fi

View File

@ -12,11 +12,7 @@ if ps -e | grep --quiet swift-container-server; then
fi
# swift-container-server is still eventlet
bind_host=$(get_config_val $conf DEFAULT bind_ip 127.0.0.1)
bind_host=$(wrap_ipv6 $(get_config_val $conf DEFAULT bind_ip 127.0.0.1))
bind_port=$(get_config_val $conf DEFAULT bind_port 6001)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/healthcheck
fi

View File

@ -12,11 +12,7 @@ if ps -e | grep --quiet swift-object-server; then
fi
# swift-object-server is still eventlet
bind_host=$(get_config_val $conf DEFAULT bind_ip 127.0.0.1)
bind_host=$(wrap_ipv6 $(get_config_val $conf DEFAULT bind_ip 127.0.0.1))
bind_port=$(get_config_val $conf DEFAULT bind_port 6000)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/healthcheck
fi

View File

@ -11,11 +11,7 @@ if pgrep -f swift-proxy-server; then
fi
# swift-proxy is still eventlet
bind_host=$(get_config_val $conf DEFAULT bind_ip 127.0.0.1)
bind_host=$(wrap_ipv6 $(get_config_val $conf DEFAULT bind_ip 127.0.0.1))
bind_port=$(get_config_val $conf DEFAULT bind_port 8080)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/healthcheck
fi

View File

@ -2,11 +2,7 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
bind_host=$(get_config_val /etc/tacker/tacker.conf DEFAULT bind_host 127.0.0.1)
bind_host=$(wrap_ipv6 $(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}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/