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