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