eoptasks: remove all digits to get cluster name

This commit is contained in:
Frédéric Péters 2019-01-08 21:42:17 +01:00
parent 5e506bcbd4
commit cdc4dbc666
1 changed files with 4 additions and 2 deletions

View File

@ -286,8 +286,10 @@ if pid:
os.system('tmux attach-session -t %s' % tmux_session_name)
else:
def cluster_name(server_name):
return re.match(r'(.*?)(\d*)$', server_name).group(1).replace(
'.rbx.', '.loc.').replace('.gra.', '.loc.').replace('.sbg.', '.loc.')
cluster_name = re.sub(r'\d', '', server_name)
for location in ('rbx', 'gra', 'sbg'):
cluster_name = cluster_name.replace('.%s.' % location, '.loc')
return cluster_name
tmux = libtmux.Server()
session = tmux.find_where({'session_name': tmux_session_name})