summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README12
-rwxr-xr-xeoptasks.py7
2 files changed, 17 insertions, 2 deletions
diff --git a/README b/README
index e792b54..f848622 100644
--- a/README
+++ b/README
@@ -38,6 +38,18 @@ It is also possible to declare additional servers, in a [servers] section, ex::
host.domain = keyword1, keyword2
+And custom keywords mapping can be defined, for shortcuts or alternative names,
+ex::
+
+ [keywords]
+ monitoring = munin,scrutiny,prometheus
+
+or to prevent common errors or misconceptions::
+
+ [keywords]
+ saas/test = saas/test,-hds,-re,-docbow
+
+
Examples
--------
diff --git a/eoptasks.py b/eoptasks.py
index ee4562c..c2d4607 100755
--- a/eoptasks.py
+++ b/eoptasks.py
@@ -124,12 +124,15 @@ def parse_args():
def filter_servers(servers, args):
selected_servers = []
if args.keywords:
- for keyword in args.keywords.split(','):
+ config = get_config()
+ cmd_keywords = config['keywords'].get(args.keywords, args.keywords)
+
+ for keyword in cmd_keywords.split(','):
keywords = set(keyword.split('/'))
selected_servers.extend(
[x for x in servers if keywords.issubset(x.keywords) and not x in selected_servers]
)
- for keyword in args.keywords.split(','):
+ for keyword in cmd_keywords.split(','):
if keyword.startswith('!') or keyword.startswith('-'):
selected_servers = [x for x in selected_servers if keyword[1:] not in x.keywords]
else: