From 35e25db259b1a0410a9ad20228eb3a4419483338 Mon Sep 17 00:00:00 2001 From: Ashley Kleynhans Date: Wed, 17 Aug 2022 23:05:36 +0200 Subject: [PATCH] fix(install): Fixed bugs in postInstall script that prevent spinnaker user from being created if it does not already exist, and thus causing halyard service to fail to start (#1959) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- halyard-web/pkg_scripts/postInstall.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/halyard-web/pkg_scripts/postInstall.sh b/halyard-web/pkg_scripts/postInstall.sh index 770ff281dc..b777ab583a 100755 --- a/halyard-web/pkg_scripts/postInstall.sh +++ b/halyard-web/pkg_scripts/postInstall.sh @@ -10,8 +10,14 @@ then HAL_USER=$(cat /opt/spinnaker/config/halyard-user) else HAL_USER=spinnaker + # Temporarily prevent commands that return non-zero exit codes + # from causing the post installation to fail. + set +e getent passwd spinnaker > /dev/null - if [ $? -gt 0 ]; then + GETENT_RESULT=$? + # Reenable checking for non-zero exit codes. + set -e + if [ $GETENT_RESULT -ne 0 ]; then useradd -s /bin/bash $HAL_USER fi if [ ! -f "/opt/spinnaker/config/halyard-user" ];