Fix sub_nodes and sub_nodes_private with multiple nodes

When you use this function with multiple sub nodes, we weren't getting
all the nodes into the /etc/nodepool/sub_nodes and
/etc/nodepool/sub_nodes_private files because the loop walked the values
one by one, and did the rsync in the same loop.

Create the files first in a separate loop so that all the values will be
there before we call rsync.

Change-Id: Id85218da7b8424acd6d1e7eac318d7ab8527dcc0
This commit is contained in:
James Slagle 2017-11-27 15:53:58 -05:00
parent 610c19d48b
commit c00df34f2e
1 changed files with 4 additions and 2 deletions

View File

@ -1596,11 +1596,13 @@ function setup_nodepool_files {
echo -n > /etc/nodepool/sub_nodes
echo -n > /etc/nodepool/sub_nodes_private
for sub_node_ip in $SUB_NODE_IPS; do
echo $sub_node_ip > /etc/nodepool/node
echo $sub_node_ip > /etc/nodepool/node_private
echo $sub_node_ip >> /etc/nodepool/sub_nodes
echo $sub_node_ip >> /etc/nodepool/sub_nodes_private
done
for sub_node_ip in $SUB_NODE_IPS; do
echo $sub_node_ip > /etc/nodepool/node
echo $sub_node_ip > /etc/nodepool/node_private
ssh $SSH_OPTIONS -tt $sub_node_ip sudo mkdir -p $TRIPLEO_ROOT
ssh $SSH_OPTIONS -tt $sub_node_ip sudo chown -R $(whoami): $TRIPLEO_ROOT
rsync -e "ssh $SSH_OPTIONS" -avhP $TRIPLEO_ROOT $sub_node_ip:$TRIPLEO_ROOT/..