summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2020-09-09 06:43:15 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2020-09-09 06:43:15 (GMT)
commit7870ac5e27209b2319cb46d2ca1598162bb9d24e (patch)
tree09ce1104da8b034dcd3dd3b649f3a569df3ddaba
parentc8a9add309feda90b18ad4e0c8019c50390748de (diff)
downloadmisc-fred-7870ac5e27209b2319cb46d2ca1598162bb9d24e.zip
misc-fred-7870ac5e27209b2319cb46d2ca1598162bb9d24e.tar.gz
misc-fred-7870ac5e27209b2319cb46d2ca1598162bb9d24e.tar.bz2
eoptasks: allow specifying multiple suffixes to be stripped
-rwxr-xr-xeoptasks/eoptasks.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/eoptasks/eoptasks.py b/eoptasks/eoptasks.py
index b204514..1daa700 100755
--- a/eoptasks/eoptasks.py
+++ b/eoptasks/eoptasks.py
@@ -85,12 +85,13 @@ def get_servers():
sys.exit(1)
ignorelist = [x.strip() for x in config.get('config', 'ignore', fallback='').split(',')]
- stripsuffix = config.get('config', 'stripsuffix', fallback='')
+ stripsuffixes = [x.strip() for x in config.get('config', 'stripsuffix', fallback='').split(',')]
servergroups = yaml.safe_load(open(servergroup))['servergroups']
def get_display_name(x):
- if stripsuffix and x.endswith(stripsuffix):
- return x[:-len(stripsuffix)]
+ for stripsuffix in stripsuffixes:
+ if stripsuffix and x.endswith(stripsuffix):
+ return x[:-len(stripsuffix)]
return x
for group in servergroups: