Skip to content
This repository was archived by the owner on Jul 7, 2020. It is now read-only.

Commit 544daf8

Browse files
author
Prasanna Kumar Kalever
committed
gk-deploy: fail to run without user-key and admin-key
Signed-off-by: Prasanna Kumar Kalever <[email protected]>
1 parent 7815b05 commit 544daf8

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

deploy/gk-deploy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/bash -x
22
# Copyright (c) 2016 Red Hat, Inc.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,8 +14,8 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
PROG="$(basename "${0}")"
18-
SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd)"
17+
PROG="$(/usr/bin/basename "${0}")"
18+
SCRIPT_DIR="$(cd "$(/usr/bin/dirname "${0}")" && pwd)"
1919
TOPOLOGY='topology.json'
2020
LOG_FILE=''
2121
VERBOSE=0
@@ -574,7 +574,7 @@ if [[ ! -f ${TOPOLOGY} ]]; then
574574
echo "Topology File not found!"
575575
exit 1
576576
else
577-
NODES=$(python - <<END
577+
NODES=$(/usr/bin/python - <<END
578578
# coding: utf8
579579
import sys
580580
import json
@@ -604,8 +604,8 @@ if [[ "x${ADMIN_KEY}" == "x" || "x${USER_KEY}" == "x" ]]; then
604604
fi
605605

606606
if [[ "x${CLI}" == "x" ]]; then
607-
kubectl=$(type kubectl 2>/dev/null | awk '{print $3}')
608-
oc=$(type oc 2>/dev/null | awk '{print $3}')
607+
kubectl=$(type kubectl 2>/dev/null | /usr/bin/awk '{print $3}')
608+
oc=$(type oc 2>/dev/null | /usr/bin/awk '{print $3}')
609609
if [[ "x${oc}" != "x" ]]; then
610610
CLI="${oc}"
611611
elif [[ "x${kubectl}" != "x" ]]; then

tests/simple/gk-deploy/test_gk_deploy_basic.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ BASE_DIR="${SCRIPT_DIR}/../../.."
88
DEPLOY_DIR="${BASE_DIR}/deploy"
99

1010
GK_DEPLOY="${DEPLOY_DIR}/gk-deploy"
11+
MANDATORY_OPTS="--admin-key=test --user-key=test"
1112
TOPOLOGY="${DEPLOY_DIR}/topology.json.sample"
1213

1314
PATH="${STUBS_DIR}:$PATH"
@@ -18,10 +19,10 @@ source "${INC_DIR}/shell_tests.sh"
1819
test_missing_topology () {
1920
local args=( -y )
2021

21-
OUT=$("${GK_DEPLOY}" "${args[@]}")
22+
OUT=$("${GK_DEPLOY}" "${MANDATORY_OPTS}" "${args[@]}")
2223
local rc=${?}
2324

24-
echo "cmd: '${GK_DEPLOY} ${args[*]}'"
25+
echo "cmd: '${GK_DEPLOY} ${MANDATORY_OPTS} ${args[*]}'"
2526
echo "output:"
2627
echo "${OUT}"
2728

@@ -37,10 +38,10 @@ test_cli_not_found () {
3738
local args=( -y )
3839
local expected_out="Container platform CLI (e.g. kubectl, oc) not found."
3940

40-
OUT=$(PATH='/doesnotexist' "${GK_DEPLOY}" "${args[@]}" "${TOPOLOGY}")
41+
OUT=$(PATH='/doesnotexist' "${GK_DEPLOY}" "${MANDATORY_OPTS}" "${args[@]}" "${TOPOLOGY}")
4142
local rc=${?}
4243

43-
echo "cmd: 'PATH='/doesnotexist' ${GK_DEPLOY} ${args[*]} ${TOPOLOGY}'"
44+
echo "cmd: 'PATH='/doesnotexist' ${GK_DEPLOY} ${MANDATORY_OPTS} ${args[*]} ${TOPOLOGY}'"
4445
echo "output:"
4546
echo "${OUT}"
4647

@@ -68,10 +69,10 @@ test_cli_unknown () {
6869
local args=( -y -c "${cli}" )
6970
local expected_out="Unknown CLI '${cli}'."
7071

71-
OUT=$("${GK_DEPLOY}" "${args[@]}" "${TOPOLOGY}")
72+
OUT=$("${GK_DEPLOY}" "${MANDATORY_OPTS}" "${args[@]}" "${TOPOLOGY}")
7273
local rc=${?}
7374

74-
echo "cmd: '${GK_DEPLOY} ${args[*]} ${TOPOLOGY}'"
75+
echo "cmd: '${GK_DEPLOY} ${MANDATORY_OPTS} ${args[*]} ${TOPOLOGY}'"
7576
echo "output:"
7677
echo "${OUT}"
7778

@@ -99,10 +100,10 @@ test_namespace_invalid () {
99100
local expected_out="Namespace 'invalid' not found"
100101

101102
# shellcheck disable=SC2086
102-
OUT=$("${GK_DEPLOY}" "${args[@]}" "${TOPOLOGY}")
103+
OUT=$("${GK_DEPLOY}" "${MANDATORY_OPTS}" "${args[@]}" "${TOPOLOGY}")
103104
local rc=${?}
104105

105-
echo "cmd: '${GK_DEPLOY} ${args[*]} ${TOPOLOGY}'"
106+
echo "cmd: '${GK_DEPLOY} ${MANDATORY_OPTS} ${args[*]} ${TOPOLOGY}'"
106107
echo "output:"
107108
echo "${OUT}"
108109

0 commit comments

Comments
 (0)