From e0a6c8746c628e080c5d2d2463ce98d0cc84038d Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Wed, 23 May 2018 15:08:34 +0200 Subject: [PATCH] TT#29620 Clean TAP test warning: CREDS appears unused [SC2034] The variable $CREDS is necessary for /usr/share/ngcp-panel-tools/ngcp-api.inc so we need to pass it explicetly to prevent shellcheck warnings here. Change-Id: Ic26425bab6b7f4b71aa267db3ec897245753b64d --- tools/ngcp-api.inc | 7 +++++++ tools_bin/ngcp-api-delete | 2 +- tools_bin/ngcp-api-get | 2 +- tools_bin/ngcp-api-patch | 2 +- tools_bin/ngcp-api-post | 2 +- tools_bin/ngcp-api-put | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/ngcp-api.inc b/tools/ngcp-api.inc index 69291e9a8d..4e2ec83d90 100644 --- a/tools/ngcp-api.inc +++ b/tools/ngcp-api.inc @@ -3,6 +3,13 @@ set -e importcreds () { + local CREDS=$1 + + if [ -z "${CREDS}" ]; then + echo "Error: missing mandatory file name to read" >&2 + exit 1 + fi + if [ ! -f "${CREDS}" ]; then return fi diff --git a/tools_bin/ngcp-api-delete b/tools_bin/ngcp-api-delete index 94c0249e00..eaef3a77d7 100755 --- a/tools_bin/ngcp-api-delete +++ b/tools_bin/ngcp-api-delete @@ -19,7 +19,7 @@ EOF if [ -z "$APIUSER" ] ; then if [ -f "$TOOLS" ] ; then source "$TOOLS" - importcreds + importcreds "$CREDS" else APIUSER="administrator:administrator" fi diff --git a/tools_bin/ngcp-api-get b/tools_bin/ngcp-api-get index 276330bb74..ddbc91dca2 100755 --- a/tools_bin/ngcp-api-get +++ b/tools_bin/ngcp-api-get @@ -19,7 +19,7 @@ EOF if [ -z "$APIUSER" ] ; then if [ -f "$TOOLS" ] ; then source "$TOOLS" - importcreds + importcreds "$CREDS" else APIUSER="administrator:administrator" fi diff --git a/tools_bin/ngcp-api-patch b/tools_bin/ngcp-api-patch index fbd9794570..045d3fa870 100755 --- a/tools_bin/ngcp-api-patch +++ b/tools_bin/ngcp-api-patch @@ -21,7 +21,7 @@ EOF if [ -z "$APIUSER" ] ; then if [ -f "$TOOLS" ] ; then source "$TOOLS" - importcreds + importcreds "$CREDS" else APIUSER="administrator:administrator" fi diff --git a/tools_bin/ngcp-api-post b/tools_bin/ngcp-api-post index b739df5623..5c0e74200f 100755 --- a/tools_bin/ngcp-api-post +++ b/tools_bin/ngcp-api-post @@ -20,7 +20,7 @@ EOF if [ -z "$APIUSER" ] ; then if [ -f "$TOOLS" ] ; then source "$TOOLS" - importcreds + importcreds "$CREDS" else APIUSER="administrator:administrator" fi diff --git a/tools_bin/ngcp-api-put b/tools_bin/ngcp-api-put index c81f83aa69..81e238d259 100755 --- a/tools_bin/ngcp-api-put +++ b/tools_bin/ngcp-api-put @@ -20,7 +20,7 @@ EOF if [ -z "$APIUSER" ] ; then if [ -f "$TOOLS" ] ; then source "$TOOLS" - importcreds + importcreds "$CREDS" else APIUSER="administrator:administrator" fi