From 5ea32b07a714f5af3efe828194e6898e9619c911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20=C3=81lvaro?= Date: Tue, 2 Jun 2020 18:48:00 +0200 Subject: [PATCH] fix: Prevents salt-api user creation if already exists --- assets/runtime/functions.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/runtime/functions.sh b/assets/runtime/functions.sh index 4456d79..f944e35 100755 --- a/assets/runtime/functions.sh +++ b/assets/runtime/functions.sh @@ -189,8 +189,10 @@ function configure_salt_api() return 2 fi - echo "Creating '${SALT_API_USER}' user for salt-api ..." - adduser --quiet --disabled-password --gecos "Salt API" "${SALT_API_USER}" + if ! id -u "${SALT_API_USER}" &>/dev/null; then + echo "Creating '${SALT_API_USER}' user for salt-api ..." + adduser --quiet --disabled-password --gecos "Salt API" "${SALT_API_USER}" + fi echo "${SALT_API_USER}:${SALT_API_USER_PASS}" | chpasswd unset SALT_API_USER_PASS fi