From 3ca6b74a48aeeaa2dc02777109dd51e953a08b65 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 22 May 2023 11:43:18 +0200 Subject: [PATCH] Hide mount failures when looking for CIDATA fixes https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud/-/issues/43 --- lib/tiny-cloud/cloud/nocloud/imds | 2 +- tests/tiny-cloud.test | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tiny-cloud/cloud/nocloud/imds b/lib/tiny-cloud/cloud/nocloud/imds index 2c7a4f0..636ec2c 100644 --- a/lib/tiny-cloud/cloud/nocloud/imds +++ b/lib/tiny-cloud/cloud/nocloud/imds @@ -56,7 +56,7 @@ _load_nocloud_volume() { [ "$mounted" ] && break for label in cidata CIDATA; do [ -n "$mounted" ] && break - mount -o ro -t "$fstype" LABEL="$label" "$mntdir" && mounted=1 + mount -o ro -t "$fstype" LABEL="$label" "$mntdir" 2>/dev/null && mounted=1 done done if [ -n "$mounted" ]; then diff --git a/tests/tiny-cloud.test b/tests/tiny-cloud.test index a9614ff..f65852b 100755 --- a/tests/tiny-cloud.test +++ b/tests/tiny-cloud.test @@ -34,6 +34,7 @@ no_metadata_boot_body() { -e not-match:"not found" \ -e not-match:"o such file" \ -o match:"rc-update add.*sshd" \ + -e not-match:"mount:" \ tiny-cloud boot done } @@ -43,6 +44,7 @@ no_userdata_early_body() { CLOUD="$provider" atf_check \ -e not-match:"unknown" \ -e match:"save_userdata.*done" \ + -e not-match:"mount:" \ tiny-cloud early done } @@ -52,6 +54,7 @@ no_userdata_main_body() { # we should not set empty hostname # we should not create .ssh dir for non-existing user CLOUD="$provider" atf_check \ + -e not-match:"mount:" \ -e not-match:"failed" \ -e not-match:"unknown" \ -o not-match:"hostname.*-F" \