From 557cada006fd5a3bd81ad5af387c37657801f8c5 Mon Sep 17 00:00:00 2001 From: Fernando Theirs Date: Thu, 13 May 2021 16:21:47 -0300 Subject: [PATCH] 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 Change-Id: Idbc60edffa978a7a6bead939a4eb54f4abae29a6 --- .../collector/scripts/collect_containerization.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/collector/scripts/collect_containerization.sh b/tools/collector/scripts/collect_containerization.sh index 7f8c6950..845b2432 100755 --- a/tools/collector/scripts/collect_containerization.sh +++ b/tools/collector/scripts/collect_containerization.sh @@ -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