def add_base_hosts_for_ssh(self):
with lcd('/app/opbin/krb_hosts'):
result = local('''grep -nE '[0-9]{1,3}(\.[0-9]{1,3}){3} +%s_match_%s' base_hosts''' % (GAME, self.id - 1))
lines = result.splitlines()
if len(lines) == 1:
rowNum, line = lines[0].split(':', 1) #???????
run('cp base_hosts bak/base_hosts.rb{}'.format(TIME))
run("sed -i '{}a {} {}' base_hosts".format(rowNum, self.ip, self.matchServer))
else:
print('[WARNING] Failed to add_base_hosts_for_ssh, can NOT locate a proper postion to add the new match entry, because there are more than one entry for {}_match_{}'.format(GAME, self.id - 1))
评论列表
文章目录