git: 30346359b377 - stable/14 - nuageinit: fix authorized_key test

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Thu, 27 Jun 2024 08:57:45 UTC
The branch stable/14 has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=30346359b3775a958a7241e90982bf68fef667fc

commit 30346359b3775a958a7241e90982bf68fef667fc
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-06-05 08:58:17 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-06-27 08:56:17 +0000

    nuageinit: fix authorized_key test
    
    After miss reading the cloudinit spec I ended up writting a wrong
    test for basic ssh key setup, nuageinit has been fixed, but not
    the test, here is the actual fix.
    
    Reported by:    markj
    
    (cherry picked from commit 8d7331e62a5aa75760ac54e3cb1594b0001645c6)
---
 libexec/nuageinit/tests/nuageinit.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libexec/nuageinit/tests/nuageinit.sh b/libexec/nuageinit/tests/nuageinit.sh
index 926233bcf66d..42c95e1b2abd 100644
--- a/libexec/nuageinit/tests/nuageinit.sh
+++ b/libexec/nuageinit/tests/nuageinit.sh
@@ -173,16 +173,17 @@ EOF
 config2_pubkeys_body()
 {
 	here=$(pwd)
+	export NUAGE_FAKE_ROOTDIR=$(pwd)
 	if [ $(id -u) -ne 0 ]; then
 		atf_skip "root required"
 	fi
 	mkdir -p media/nuageinit
-	cat > media/nuageinit/meta_data.json << EOF
-{
-   "public_keys": {
-       "mykey": "ssh-rsa AAAAB3NzaC1y...== Generated by Nova"
-   },
-}
+	touch media/nuageinit/meta_data.json
+	cat > media/nuageinit/user-data << EOF
+#cloud-config
+
+ssh_authorized_keys:
+  - "ssh-rsa AAAAB3NzaC1y...== Generated by Nova"
 EOF
 	mkdir -p etc
 	cat > etc/master.passwd <<EOF
@@ -194,7 +195,6 @@ EOF
 wheel:*:0:root
 users:*:1:
 EOF
-	export NUAGE_FAKE_ROOTDIR=$(pwd)
 	atf_check /usr/libexec/nuageinit ${here}/media/nuageinit config-2
 	atf_check -o inline:"ssh-rsa AAAAB3NzaC1y...== Generated by Nova\n" cat home/freebsd/.ssh/authorized_keys
 }