Merge pull request #32 from olljanat/fix-ip-regex
Correct regex logic used to changing IP addresses
This commit is contained in:
commit
4385d8a853
|
|
@ -203,7 +203,7 @@ redis_cluster_update_ips() {
|
||||||
# The node can be new if we are updating the cluster, so catch the unbound variable error
|
# The node can be new if we are updating the cluster, so catch the unbound variable error
|
||||||
if [[ ${host_2_ip_array[$node]+true} ]]; then
|
if [[ ${host_2_ip_array[$node]+true} ]]; then
|
||||||
echo "Changing old IP ${host_2_ip_array[$node]} by the new one ${newIP}"
|
echo "Changing old IP ${host_2_ip_array[$node]} by the new one ${newIP}"
|
||||||
nodesFile=$(sed "s/${host_2_ip_array[$node]}/$newIP/g" "${REDIS_DATA_DIR}/nodes.conf")
|
nodesFile=$(sed "s/ ${host_2_ip_array[$node]}:/ $newIP:/g" "${REDIS_DATA_DIR}/nodes.conf")
|
||||||
echo "$nodesFile" >"${REDIS_DATA_DIR}/nodes.conf"
|
echo "$nodesFile" >"${REDIS_DATA_DIR}/nodes.conf"
|
||||||
fi
|
fi
|
||||||
host_2_ip_array["$node"]="$newIP"
|
host_2_ip_array["$node"]="$newIP"
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ redis_cluster_update_ips() {
|
||||||
# The node can be new if we are updating the cluster, so catch the unbound variable error
|
# The node can be new if we are updating the cluster, so catch the unbound variable error
|
||||||
if [[ ${host_2_ip_array[$node]+true} ]]; then
|
if [[ ${host_2_ip_array[$node]+true} ]]; then
|
||||||
echo "Changing old IP ${host_2_ip_array[$node]} by the new one ${newIP}"
|
echo "Changing old IP ${host_2_ip_array[$node]} by the new one ${newIP}"
|
||||||
nodesFile=$(sed "s/${host_2_ip_array[$node]}/$newIP/g" "${REDIS_DATA_DIR}/nodes.conf")
|
nodesFile=$(sed "s/ ${host_2_ip_array[$node]}:/ $newIP:/g" "${REDIS_DATA_DIR}/nodes.conf")
|
||||||
echo "$nodesFile" >"${REDIS_DATA_DIR}/nodes.conf"
|
echo "$nodesFile" >"${REDIS_DATA_DIR}/nodes.conf"
|
||||||
fi
|
fi
|
||||||
host_2_ip_array["$node"]="$newIP"
|
host_2_ip_array["$node"]="$newIP"
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ redis_cluster_update_ips() {
|
||||||
# The node can be new if we are updating the cluster, so catch the unbound variable error
|
# The node can be new if we are updating the cluster, so catch the unbound variable error
|
||||||
if [[ ${host_2_ip_array[$node]+true} ]]; then
|
if [[ ${host_2_ip_array[$node]+true} ]]; then
|
||||||
echo "Changing old IP ${host_2_ip_array[$node]} by the new one ${newIP}"
|
echo "Changing old IP ${host_2_ip_array[$node]} by the new one ${newIP}"
|
||||||
nodesFile=$(sed "s/${host_2_ip_array[$node]}/$newIP/g" "${REDIS_DATA_DIR}/nodes.conf")
|
nodesFile=$(sed "s/ ${host_2_ip_array[$node]}:/ $newIP:/g" "${REDIS_DATA_DIR}/nodes.conf")
|
||||||
echo "$nodesFile" >"${REDIS_DATA_DIR}/nodes.conf"
|
echo "$nodesFile" >"${REDIS_DATA_DIR}/nodes.conf"
|
||||||
fi
|
fi
|
||||||
host_2_ip_array["$node"]="$newIP"
|
host_2_ip_array["$node"]="$newIP"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue