Skip to content

Commit 3ba141f

Browse files
committed
[NRL-1922] Fix missing returns for shell functions
1 parent 0e5395e commit 3ba141f

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

scripts/bootstrap.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ function _check_mgmt() {
3232
echo "Please log in as the mgmt account" >&2
3333
return 1
3434
fi
35+
return 0
3536
}
3637

3738
function _check_non_mgmt() {
3839
if [[ "$(aws iam list-account-aliases --query 'AccountAliases[0]' --output text)" == 'nhsd-ddc-spine-nrlf-mgmt' ]]; then
3940
echo "Please log in as a non-mgmt account" >&2
4041
return 1
4142
fi
43+
return 0
4244
}
4345

4446
function _bootstrap() {
@@ -129,7 +131,7 @@ function _bootstrap() {
129131
local workspace
130132
workspace=$2
131133
# Fetch the resources using the AWS CLI command
132-
aws resourcegroupstaggingapi get-resources --tag-filters Key=workspace,Values="$2" | jq -c '.ResourceTagMappingList[]' |
134+
aws resourcegroupstaggingapi get-resources --tag-filters Key=workspace,Values="${workspace}" | jq -c '.ResourceTagMappingList[]' |
133135
while IFS= read -r item; do
134136
arn=$(jq -r '.ResourceARN' <<< "$item")
135137

@@ -206,6 +208,8 @@ function _bootstrap() {
206208
#----------------
207209
*) _bootstrap_help ;;
208210
esac
211+
212+
return 0
209213
}
210214

211215
_bootstrap "${@:1}"

scripts/check-build-environment.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ function success() {
1010

1111
local message="$1"
1212
echo "${message}"
13+
return 0
1314
}
1415

1516
function warning() {
1617
local message="$1"
1718
echo -e " ⚠️ \e[31m${message}\e[39m"
19+
return 0
1820
}
1921

2022
echo
@@ -38,7 +40,7 @@ for dep in ${BUILD_DEPENDENCIES}; do
3840
dep_path="$(which ${dep} 2> /dev/null)"
3941
set -e
4042

41-
if [[ -n "${dep_path}" -a -x "${dep_path}" ]]
43+
if [[ -n "${dep_path}" && -x "${dep_path}" ]]
4244
then
4345
success "${dep} found at ${dep_path}"
4446
else

scripts/check-deploy-environment.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ function success() {
1313

1414
local message="$1"
1515
echo "${message}"
16+
return 0
1617
}
1718

1819
function warning() {
1920
local message="$1"
2021
echo -e " ⚠️ \e[31m${message}\e[39m"
22+
return 0
2123
}
2224

2325
echo

scripts/pull-lambda-code-for-stack.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ function pull_lambda_code(){
2222
echo -n "- Downloading code for lambda ${lambda_name}.... "
2323
code_url="$(aws lambda get-function --function-name "${lambda_name}" | jq -r .Code.Location)"
2424
curl "${code_url}" 2>/dev/null > "${DIST_DIR}/${api_name}-${endpoint_name}.zip"
25+
2526
echo ""
27+
return 0
2628
}
2729

2830
function pull_layer_code(){
@@ -35,7 +37,9 @@ function pull_layer_code(){
3537
echo -n "- Downloading code for layer ${layer_name} version ${layer_version}.... "
3638
code_url="$(aws lambda get-layer-version --layer-name "${layer_name}" --version-number "${layer_version}" | jq -r .Content.Location)"
3739
curl "${code_url}" 2>/dev/null > "${DIST_DIR}/${layer_pkg_name}"
40+
3841
echo ""
42+
return 0
3943
}
4044

4145
mkdir -p "${DIST_DIR}"

0 commit comments

Comments
 (0)