|
@@ -25,7 +25,7 @@ call("git clone --recursive git@git.yoho.cn:yohoops/auto_deploy.git %s" % PATH |
|
@@ -25,7 +25,7 @@ call("git clone --recursive git@git.yoho.cn:yohoops/auto_deploy.git %s" % PATH |
25
|
|
25
|
|
26
|
# get iptables info from git files.
|
26
|
# get iptables info from git files.
|
27
|
azs_mappings = {"qcloud": "az1", "qcloudaz2": "az2", "qcloudaz3": "az3"}
|
27
|
azs_mappings = {"qcloud": "az1", "qcloudaz2": "az2", "qcloudaz3": "az3"}
|
28
|
-host_group = { "yoho_gateway": "java-gateway",
|
28
|
+host_group = {"yoho_gateway": "java-gateway",
|
29
|
"yoho_users": "java-users",
|
29
|
"yoho_users": "java-users",
|
30
|
"yohobuy_resources": "java-resources",
|
30
|
"yohobuy_resources": "java-resources",
|
31
|
"yohobuy_order" : "java-order",
|
31
|
"yohobuy_order" : "java-order",
|
|
@@ -47,15 +47,16 @@ for _az in azs_mappings.keys(): |
|
@@ -47,15 +47,16 @@ for _az in azs_mappings.keys(): |
47
|
all_groups[azs_mappings[_az]] = groups
|
47
|
all_groups[azs_mappings[_az]] = groups
|
48
|
file = open(os.path.join(PATH, "scripts/iptable/", _az, "app-iptable.sh"), 'r')
|
48
|
file = open(os.path.join(PATH, "scripts/iptable/", _az, "app-iptable.sh"), 'r')
|
49
|
for line in file:
|
49
|
for line in file:
|
50
|
- for group_name in host_group.keys():
|
|
|
51
|
- if group_name in line:
|
50
|
+ for deploy_prj_name in host_group.keys():
|
|
|
51
|
+ if line.strip().startswith(deploy_prj_name):
|
52
|
g_hosts = []
|
52
|
g_hosts = []
|
53
|
- groups[host_group[group_name]] = g_hosts
|
53
|
+ groups[host_group[deploy_prj_name]] = g_hosts
|
54
|
i_1 = line.index("(")
|
54
|
i_1 = line.index("(")
|
55
|
i_2 = line.index(")")
|
55
|
i_2 = line.index(")")
|
56
|
sub = line[i_1 + 1 : i_2]
|
56
|
sub = line[i_1 + 1 : i_2]
|
57
|
- for user_ip in sub.split(" "):
|
|
|
58
|
- g_hosts.append(user_ip[user_ip.index("@") + 1 : ].strip())
|
57
|
+ for user_ip in sub.split("master@"):
|
|
|
58
|
+ if user_ip.strip() != '':
|
|
|
59
|
+ g_hosts.append(user_ip.strip())
|
59
|
|
60
|
|
60
|
|
61
|
|
61
|
file.close()
|
62
|
file.close()
|