Collect is missing etcdctl output

When the collect tool is run, it does not include the contents
of the etcd database. Fixes have been made for this to dump the
contents in "etcd_database.dump" file.

Verify if etcd access is secured. In that case, certificates
will be used.

Closes-Bug: 1911935

Signed-off-by: Fernando Theirs <Fernando.Theirs@windriver.com>
Change-Id: Idbc60edffa978a7a6bead939a4eb54f4abae29a6
This commit is contained in:
Fernando Theirs 2021-05-13 16:21:47 -03:00 committed by Fernando Theirs
parent 6045b1b8a0
commit 557cada006

View File

@ -187,9 +187,18 @@ if [ "$nodetype" = "controller" -a "${ACTIVE}" = true ] ; then
delimiter ${LOGFILE} "${CMD}"
${CMD} 2>>${COLLECT_ERROR_LOG}
# NOTE(LP1911935): The following etcdctl command is not producing output.
export ETCDCTL_API=3
CMD="etcdctl --endpoints=localhost:2379 get / --prefix"
export $(grep '^ETCD_LISTEN_CLIENT_URLS=' /etc/etcd/etcd.conf | tr -d '"')
CMD="sudo ETCDCTL_API=3 etcdctl \
--endpoints=$ETCD_LISTEN_CLIENT_URLS get / --prefix"
#Use certificate if secured access is detected
SEC_STR='https'
if [[ "$ETCD_LISTEN_CLIENT_URLS" == *"$SEC_STR"* ]]; then
CMD="$CMD --cert=/etc/etcd/etcd-server.crt \
--key=/etc/etcd/etcd-server.key --cacert=/etc/etcd/ca.crt"
fi
delimiter ${LOGFILE} "${CMD}"
${CMD} 2>>${COLLECT_ERROR_LOG} >> ${ETCD_DB_FILE}
fi