mirror of
https://github.com/bitnami/containers.git
synced 2026-02-27 06:47:29 +08:00
Fix empty member removal log, improve comment (#28)
This commit is contained in:
@@ -19,4 +19,7 @@ if is_empty_value "${endpoints}"; then
|
||||
fi
|
||||
read -r -a extra_flags <<< "$(etcdctl_auth_flags)"
|
||||
extra_flags+=("--endpoints=${endpoints}" "--debug=true")
|
||||
etcdctl member remove "$(cat "${ETCD_DATA_DIR}/member_id")" "${extra_flags[@]}" > "$(dirname "$ETCD_DATA_DIR")/member_removal.log"
|
||||
# We use 'stdbuf' to ensure memory buffers are flushed to disk
|
||||
# so we reduce the chances that the "member_removal.log" file is empty.
|
||||
# ref: https://www.gnu.org/software/coreutils/manual/html_node/stdbuf-invocation.html#stdbuf-invocation
|
||||
stdbuf -oL etcdctl member remove "$(cat "${ETCD_DATA_DIR}/member_id")" "${extra_flags[@]}" > "$(dirname "$ETCD_DATA_DIR")/member_removal.log"
|
||||
|
||||
@@ -312,7 +312,7 @@ etcd_store_member_id() {
|
||||
if retry_while "etcdctl ${extra_flags[*]} member list" >/dev/null 2>&1; then
|
||||
while [[ ! -s "${ETCD_DATA_DIR}/member_id" ]]; do
|
||||
# We use 'stdbuf' to ensure memory buffers are flushed to disk
|
||||
# so we reduce the chances that the "member_id" file is not created.
|
||||
# so we reduce the chances that the "member_id" file is empty.
|
||||
# ref: https://www.gnu.org/software/coreutils/manual/html_node/stdbuf-invocation.html#stdbuf-invocation
|
||||
read -r -a advertised_array <<< "$(tr ',;' ' ' <<< "$ETCD_ADVERTISE_CLIENT_URLS")"
|
||||
stdbuf -oL etcdctl "${extra_flags[@]}" member list | grep -w "${advertised_array[0]}" | awk -F "," '{ print $1}' > "${ETCD_DATA_DIR}/member_id" || true
|
||||
|
||||
Reference in New Issue
Block a user