From 6a4230f60f4036950e2673f820c52d6f2a2bc45f Mon Sep 17 00:00:00 2001 From: Hippolyte HENRY Date: Tue, 4 Jun 2019 18:25:20 +0200 Subject: [PATCH] Fixes the --tags argument for service_checks in dogshell (#387) * Fixes the --tags argument for service_checks in dogshell * strip when checking if truthy --- datadog/dogshell/service_check.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/datadog/dogshell/service_check.py b/datadog/dogshell/service_check.py index 2b20825d1..1abbfcdb4 100644 --- a/datadog/dogshell/service_check.py +++ b/datadog/dogshell/service_check.py @@ -31,9 +31,13 @@ def setup_parser(cls, subparsers): def _check(cls, args): api._timeout = args.timeout format = args.format + if args.tags: + tags = sorted(set([t.strip() for t in args.tags.split(',') if t.strip()])) + else: + tags = None res = api.ServiceCheck.check( check=args.check, host_name=args.host_name, status=int(args.status), - timestamp=args.timestamp, message=args.message, tags=args.tags) + timestamp=args.timestamp, message=args.message, tags=tags) report_warnings(res) report_errors(res) if format == 'pretty':