From 801be49523e69138cf4849f6838ddc7ba2033351 Mon Sep 17 00:00:00 2001 From: Quinn Stevens Date: Fri, 31 Jul 2020 11:39:20 +0100 Subject: [PATCH] Return default behaviour to previous, remove distinction between strict & non-strict matching --- include/outputs | 9 ++------- whitelist_sample.txt | 10 ++++------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/include/outputs b/include/outputs index 7c69dd53..0bc29ad6 100644 --- a/include/outputs +++ b/include/outputs @@ -114,13 +114,8 @@ textFail(){ while read -r i; do ignore_check_name="${i%%:*}" # Check name is everything up to the first : ignore_value="${i#*${CHECK_NAME}:}" # Ignore value is everything after the first : - if [[ ${ignore_value} =~ .*:f ]]; then - # Fuzzy search - if this pattern appears anywhere in the line, it matches. - resource_value=".*${ignore_value%:*}.*" - else - # Strict search - pattern has to be its own word. - resource_value="[[:space:]^]${ignore_value}[[:space:]$]" - fi + # Check to see if ignore value appears anywhere within log message. + resource_value=".*${ignore_value}.*" if [[ ${ignore_check_name} != "${CHECK_NAME}" ]]; then # not for this check continue diff --git a/whitelist_sample.txt b/whitelist_sample.txt index eed1f175..a17829e3 100644 --- a/whitelist_sample.txt +++ b/whitelist_sample.txt @@ -3,12 +3,10 @@ # Example: Will not consider a myignoredbucket failures as full failure. (Still printed as a warning) check26:myignoredbucket -# By default, whitelisting something (e.g. "ci-logs") will only whitelist resources specifically called -# "ci-logs". However, if you put ":f" at the end of the line, it will do a fuzzy match, and will -# whitelist all resources with "ci-logs" in their name. +# Note that by default, this searches for the string appearing *anywhere* in the resource name. # For example: -# extra718:ci-logs # Will block bucket "ci-logs" but not bucket "ci-logs-replica" -# extra718:ci-logs:f # Will block any bucket containing the term "ci-logs" +# extra718:ci-logs # Will block bucket "ci-logs" AND ALSO bucket "ci-logs-replica" +# extra718:logs # Will block EVERY BUCKET containing the string "logs" # line starting with # are ignored as comments # add a line per resource as here: @@ -20,4 +18,4 @@ check26:myignoredbucket # REGEXES # This whitelist works with regexes (ERE, the same style of regex as grep -E and bash's =~ use) # therefore: -# extra718:[[:alnum:]]+-logs:f # will ignore all buckets containing the terms ci-logs, qa-logs, etc. \ No newline at end of file +# extra718:[[:alnum:]]+-logs # will ignore all buckets containing the terms ci-logs, qa-logs, etc. \ No newline at end of file