Skip to content

Commit b855521

Browse files
author
French Ben
committed
Remove unnecessary calls
Signed-off-by: French Ben <[email protected]>
1 parent 9d4e886 commit b855521

File tree

6 files changed

+16
-43
lines changed

6 files changed

+16
-43
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
EDITIONS_TAG := beta11
2-
EDITIONS_DOCKER_VERSION := 1.13.0-RC1
2+
EDITIONS_DOCKER_VERSION := 1.13.0-rc1
33
EDITIONS_VERSION := $(EDITIONS_DOCKER_VERSION)-$(EDITIONS_TAG)
44
REGION := us-west-1
55
CHANNEL := beta

aws/dockerfiles/Dockerfile.meta

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ RUN apk add --update ca-certificates && rm -Rf /tmp/* /var/lib/cache/apk/*
66
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
77

88
ADD files/bin/metaserver /usr/local/bin/
9+
RUN chmod +x /usr/local/bin/metaserver
910

1011
CMD [ "metaserver" ]

azure/dockerfiles/Dockerfile.meta

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ RUN apk add --update ca-certificates && rm -Rf /tmp/* /var/lib/cache/apk/*
66
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
77

88
ADD files/bin/metaserver /usr/local/bin/
9+
RUN chmod +x /usr/local/bin/metaserver
910

1011
CMD [ "metaserver" ]

azure/dockerfiles/files/guide/refresh.sh

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,17 @@ if [ "$NODE_TYPE" == "worker" ] ; then
55
exit 0
66
fi
77

8-
get_manager_token()
9-
{
10-
if [ -n "$MANAGER_IP" ]; then
11-
export MANAGER_TOKEN=$(wget -qO- http://$MANAGER_IP:9024/token/manager/)
12-
echo "MANAGER_TOKEN=$MANAGER_TOKEN"
13-
else
14-
echo "MANAGER_TOKEN can't be found yet. MANAGER_IP isn't set yet."
15-
fi
16-
}
17-
18-
get_worker_token()
19-
{
20-
if [ -n "$MANAGER_IP" ]; then
21-
export WORKER_TOKEN=$(wget -qO- http://$MANAGER_IP:9024/token/worker/)
22-
echo "WORKER_TOKEN=$WORKER_TOKEN"
23-
else
24-
echo "WORKER_TOKEN can't be found yet. MANAGER_IP isn't set yet."
25-
fi
26-
}
27-
288
IS_LEADER=$(docker node inspect self -f '{{ .ManagerStatus.Leader }}')
299

3010
if [[ "$IS_LEADER" == "true" ]]; then
3111
# we are the leader, We only need to call once, so we only call from the current leader.
3212
MYIP=$(ifconfig eth0 | grep "inet addr:" | cut -d: -f2 | cut -d" " -f1)
33-
CURRENT_MANAGER_IP=$(python /usr/bin/azuretokens.py get-ip)
13+
CURRENT_MANAGER_IP=$(python /usr/bin/azureleader.py get-ip)
3414
echo "Current manager IP = $CURRENT_MANAGER_IP ; my IP = $MYIP"
3515

3616
if [ "$CURRENT_MANAGER_IP" == "$MYIP" ]; then
3717
echo "Swarm Manager IP changed, updating azure table with new ip"
38-
python /usr/bin/azuretokens.py insert-ip $MYIP
18+
python /usr/bin/azureleader.py insert-ip $MYIP
3919
fi
4020

4121
fi

azure/dockerfiles/files/init/azuretokens.py renamed to azure/dockerfiles/files/init/azureleader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def print_ip(sa_key):
4343
return False
4444
try:
4545
token = tbl_svc.get_entity(TBL_NAME, PARTITION_NAME, ROW_ID)
46-
print '{}'.format(token.manager_ip)
46+
print('{}'.format(token.manager_ip))
4747
return True
4848
except:
4949
return False

azure/dockerfiles/files/init/entry.sh

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,14 @@ get_node_id()
2828
echo "NODE: $NODE_ID"
2929
}
3030

31-
get_tokens_db()
31+
get_tokens()
3232
{
3333
echo "Get MANAGER IP from Azure Table"
34-
export MANAGER_IP=$(python azuretokens.py get-ip)
34+
export MANAGER_IP=$(python azureleader.py get-ip)
3535
get_manager_token
3636
get_worker_token
3737
}
3838

39-
get_tokens_local()
40-
{
41-
export MANAGER_TOKEN=$(docker swarm join-token manager -q)
42-
export WORKER_TOKEN=$(docker swarm join-token worker -q)
43-
echo "MANAGER_TOKEN=$MANAGER_TOKEN"
44-
echo "WORKER_TOKEN=$WORKER_TOKEN"
45-
}
46-
4739
get_manager_token()
4840
{
4941
if [ -n "$MANAGER_IP" ]; then
@@ -69,7 +61,7 @@ confirm_primary_ready()
6961
n=0
7062
until [ $n -ge 5 ]
7163
do
72-
get_tokens_db
64+
get_tokens
7365
echo "PRIMARY_MANAGER_IP=$MANAGER_IP"
7466
# if Manager IP or manager_token is empty or manager_token is null, not ready yet.
7567
# token would be null for a short time between swarm init, and the time the
@@ -113,7 +105,7 @@ join_as_secondary_manager()
113105
n=$[$n+1]
114106

115107
# query azure table again, incase the manager changed
116-
get_tokens_db
108+
get_tokens
117109
else
118110
echo "Connected to primary manager, NODE_ID=$NODE_ID , SWARM_ID=$SWARM_ID"
119111
break
@@ -134,21 +126,20 @@ setup_manager()
134126
# try to create the azure table that will store tokens, if it succeeds then it is the first
135127
# and it is the primary manager. If it fails, then it isn't first, and treat the record
136128
# that is there, as the primary manager, and join that swarm.
137-
python azuretokens.py create-table
129+
python azureleader.py create-table
138130
PRIMARY_RESULT=$?
139131
echo " PRIMARY_RESULT=$PRIMARY_RESULT"
140132

141133
if [ $PRIMARY_RESULT -eq 0 ]; then
142134
echo " Primary Manager init"
143135
# we are the primary, so init the cluster
144136
docker swarm init --listen-addr $PRIVATE_IP:2377 --advertise-addr $PRIVATE_IP:2377
145-
# we can now get the tokens.
146-
get_tokens_local
137+
# we can now get the swarm id and node id.
147138
get_swarm_id
148139
get_node_id
149140

150-
# update azure table with the tokens
151-
python azuretokens.py insert-ip $PRIVATE_IP
141+
# update azure table with the ip
142+
python azureleader.py insert-ip $PRIVATE_IP
152143

153144
echo " Primary Manager init complete"
154145
# send identify message
@@ -193,7 +184,7 @@ setup_worker()
193184
n=$[$n+1]
194185

195186
# query azure table again, incase the manager changed
196-
get_tokens_db
187+
get_tokens
197188
else
198189
echo "Connected to manager, NODE_ID=$NODE_ID , SWARM_ID=$SWARM_ID"
199190
break
@@ -203,7 +194,7 @@ setup_worker()
203194
}
204195

205196
# init variables based on azure token table contents (if populated)
206-
get_tokens_db
197+
get_tokens
207198

208199
# if it is a manager, setup as manager, if not, setup as worker node.
209200
if [ "$ROLE" == "MANAGER" ] ; then

0 commit comments

Comments
 (0)