Skip to content

Commit 19b8bba

Browse files
committed
Fix scripts print success when errorining due to unbound variables
1 parent 3f8bdf9 commit 19b8bba

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packer/linux/conf/bin/bk-configure-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on_exit() {
1717
echo "${BASH_SOURCE[0]} completed successfully."
1818
}
1919

20-
trap on_exit EXIT
20+
trap '[[ $? = 0 ]] && on_exit' EXIT
2121

2222
## Configure docker before system starts
2323

packer/linux/conf/bin/bk-install-elastic-stack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ on_exit() {
3535
echo "${BASH_SOURCE[0]} completed successfully."
3636
}
3737

38-
trap on_exit EXIT
38+
trap '[[ $? = 0 ]] && on_exit' EXIT
3939

4040
# Write to system console and to our log file
4141
# See https://alestic.com/2010/12/ec2-user-data-output/

packer/linux/conf/bin/bk-mount-instance-storage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on_exit() {
1616
echo "${BASH_SOURCE[0]} completed successfully."
1717
}
1818

19-
trap on_exit EXIT
19+
trap '[[ $? = 0 ]] && on_exit' EXIT
2020

2121
# Write to system console and to our log file
2222
# See https://alestic.com/2010/12/ec2-user-data-output/

0 commit comments

Comments
 (0)