diff --git a/eoptasks/eoptasks.py b/eoptasks/eoptasks.py index 4ec59a7..cd56025 100755 --- a/eoptasks/eoptasks.py +++ b/eoptasks/eoptasks.py @@ -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})