tripleo-common/healthcheck/etcd
James Slagle a5f5b369d4 Fix etcd healthcheck
The etcd healthcheck was not working as it was trying to use
127.0.0.1:2379 as the etcd endpoint when none was specified.

This patch updates the healthcheck to set the $ETCDCTL_ENDPOINTS
environment variable for the etcdctl command after reading the value
from /etc/etcd/etcd.conf.

It also updates the existing healthcheck logic to use "grep -q" so that
log entries are not continually created every time the healthcheck is
executed.

Change-Id: If5ee2fdecf8c9ba458bce92fc2c427aeed1b865a
2019-10-09 10:21:05 -04:00

7 lines
191 B
Bash
Executable File

#!/bin/bash
export ETCDCTL_API=3
export $(grep ETCD_LISTEN_CLIENT_URLS /etc/etcd/etcd.conf)
ETCDCTL_ENDPOINTS=$ETCD_LISTEN_CLIENT_URLS etcdctl endpoint health | grep -q "is healthy"
exit $?