From 156c4118360e979d6bc426c730c94088e62a16a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Fri, 12 May 2023 08:34:55 +0200 Subject: [PATCH] ostree-simplified-installer.sh: fix waiting loop for fdouser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ssh grep fdouser /etc/passwd` returns 1 if the user doesn't exist yet. We run this script with set -euo pipefail, which cause the script to exit immediately. Thus, the waiting loop isn't actually waiting for anything. By adding `|| true`, we ensure that the loop is indeed waiting for the fdouser to be available. Signed-off-by: Ondřej Budai --- test/cases/ostree-simplified-installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cases/ostree-simplified-installer.sh b/test/cases/ostree-simplified-installer.sh index 0558a7be4..6730552c1 100755 --- a/test/cases/ostree-simplified-installer.sh +++ b/test/cases/ostree-simplified-installer.sh @@ -17,7 +17,7 @@ sudo pip3 install yq==v3.2.1 sudo dnf install -y fdo-admin-cli # Start fdo-aio to have /etc/fdo/aio folder sudo systemctl enable --now fdo-aio -# Prepare service api server config file +# Prepare service api server config filef sudo /usr/local/bin/yq -iy '.service_info.diskencryption_clevis |= [{disk_label: "/dev/vda4", reencrypt: true, binding: {pin: "tpm2", config: "{}"}}]' /etc/fdo/aio/configs/serviceinfo_api_server.yml sudo systemctl restart fdo-aio @@ -668,7 +668,7 @@ done if [[ "${ANSIBLE_USER}" == "fdouser" ]]; then greenprint "🕹 Check if user 'fdouser' exist in edge vm" for _ in $(seq 0 30); do - FDOUSER_EXIST=$(ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" admin@$PUB_KEY_GUEST_ADDRESS "grep fdouser /etc/passwd") + FDOUSER_EXIST=$(ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" admin@$PUB_KEY_GUEST_ADDRESS "grep fdouser /etc/passwd || true") if [[ ${FDOUSER_EXIST} =~ "fdouser" ]]; then echo "fdouser has been created" break