From c9abcaaa9657aaa1699ef33533820f18413bba26 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 11 Aug 2014 21:41:42 +0200 Subject: Reaktor nag: add support for service inspection --- commands/nag | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'commands/nag') diff --git a/commands/nag b/commands/nag index e552e11..fabeec8 100755 --- a/commands/nag +++ b/commands/nag @@ -35,17 +35,32 @@ diff -u nag.hosts.ls nag.services.ls > nag.patch || : missing_services=$(sed -n '1d;2d;s/^-\(.*\)/\1/p' nag.patch | tr '\n' ' ') obsolete_services=$(sed -n '1d;2d;s/^+\(.*\)/\1/p' nag.patch | tr '\n' ' ') +if test "${inspect_services-false}" = true; then + missing_owners=$(set +f; cd nag.services && grep '^owner:$' * | cut -d: -f1) + missing_mailtos=$(set +f; cd nag.services && grep '^mailto:$' * | cut -d: -f1) +fi # # output # +did_nag=false if test -n "$missing_services"; then echo missing services: $missing_services + did_nag=true fi if test -n "$obsolete_services"; then echo obsolete services: $obsolete_services + did_nag=true +fi +if test -n "${missing_owners-}"; then + echo services with missing owner entry: $missing_owners + did_nag=true +fi +if test -n "${missing_mailtos-}"; then + echo services with missing mailto entry: $missing_mailtos + did_nag=true fi # if asked directly, answer if there is nothing to nag about -if test -z "$missing_services$obsolete_services" -a -n "${_from:-}";then +if test $did_nag = false -a -n "${_from:-}";then echo "nothing to nag about" fi -- cgit v1.2.3