fix: Prevents salt-api user creation if already exists

This commit is contained in:
Carlos Álvaro
2020-06-02 18:48:00 +02:00
parent 7a0408aa38
commit 5ea32b07a7

View File

@@ -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