Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use correct variable name to check platform version #503

Merged
merged 4 commits into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions dev/scripts/helper.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash
CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
source "${CUR_DIR}/env.sh"

start_time=$(date +%s)
TMP_DIR="${SCRIPT_DIR}/../temp"

Expand Down Expand Up @@ -282,10 +285,16 @@ function copy_node_keys() {

# prepare address book using all nodes pod IP and store as config.txt
function prep_address_book() {
IFS=. read -a VERSION_PARTS <<< "$PLATFORM_VERSION"
local MINOR_VERSION=${VERSION_PARTS[1]}

echo ""
echo "Preparing address book"
echo "PLATFORM_VERSION [ MAJOR: ${VERSION_PARTS[0]}, MINOR=${VERSION_PARTS[1]}, PATCH=${VERSION_PARTS[2]} ]"
echo "-----------------------------------------------------------------------------------------------------"



local config_file="${TMP_DIR}/config.txt"
local node_IP=""
local node_seq="${NODE_SEQ:-0}" # this also used as the account ID suffix
Expand Down Expand Up @@ -342,7 +351,7 @@ function prep_address_book() {
local external_ip="${SVC_IP}"

# for v.40.* onward
if [[ "${PLATFORM_PROFILE}" == v0.4* ]]; then
if [[ "${MINOR_VERSION}" -ge "40" ]]; then
local node_nick_name="${node_name}"
config_lines+=("address, ${node_seq}, ${node_nick_name}, ${node_name}, ${node_stake}, ${internal_ip}, ${internal_port}, ${external_ip}, ${external_port}, ${account}")
else
Expand All @@ -355,7 +364,9 @@ function prep_address_book() {
done

# for v.41.* onward
# config_lines+=("nextNodeId, ${node_seq}")
if [[ "${MINOR_VERSION}" -ge "41" ]]; then
config_lines+=("nextNodeId, ${node_seq}")
fi

# write contents to config file
cp "${SCRIPT_DIR}/../local-node/config.template" "${config_file}" || return "${EX_ERR}"
Expand Down