summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2019-01-08 20:42:17 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2019-01-08 20:42:17 (GMT)
commitcdc4dbc6661ad8427c573edb8666e210b8d75102 (patch)
tree00c5bbc11643223b0d23f3ed1e152136d1791e3a
parent5e506bcbd47ebcbafeaebdac42a29729bc5479ab (diff)
downloadmisc-fred-cdc4dbc6661ad8427c573edb8666e210b8d75102.zip
misc-fred-cdc4dbc6661ad8427c573edb8666e210b8d75102.tar.gz
misc-fred-cdc4dbc6661ad8427c573edb8666e210b8d75102.tar.bz2
eoptasks: remove all digits to get cluster name
-rwxr-xr-xeoptasks/eoptasks.py6
1 files changed, 4 insertions, 2 deletions
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})