Bug 280461 - nuageinit does not process user details in meta_data file
Summary: nuageinit does not process user details in meta_data file
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Baptiste Daroussin
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-07-26 22:26 UTC by Tim Bishop
Modified: 2024-10-10 06:50 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Bishop freebsd_committer freebsd_triage 2024-07-26 22:26:24 UTC
On OpenStack 2024.1 running on Ubuntu, the config drive looks like this:

root@freebsd-14-test:/ # ls -l /dev/iso9660/config-2
crw-r-----  1 root operator 0x5c Jul 26 21:13 /dev/iso9660/config-2
root@freebsd-14-test:/ # mount -t cd9660 /dev/iso9660/config-2 /mnt
root@freebsd-14-test:/ # ls -l /mnt/
total 4
dr-xr-xr-x   4 root wheel 2048 Jul 26 21:13 ec2
dr-xr-xr-x  12 root wheel 2048 Jul 26 21:13 openstack
root@freebsd-14-test:/ # ls -l /mnt/openstack/
total 20
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 2012-08-10
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 2013-04-04
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 2013-10-17
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 2015-10-15
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 2016-06-30
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 2016-10-06
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 2017-02-22
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 2018-08-27
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 2020-10-14
dr-xr-xr-x  2 root wheel 2048 Jul 26 21:13 latest
root@freebsd-14-test:/ # ls -l /mnt/openstack/latest/
total 2
-r--r--r--  1 root wheel 1274 Jul 26 21:13 meta_data.json
-r--r--r--  1 root wheel 1218 Jul 26 21:13 network_data.json
-r--r--r--  1 root wheel    2 Jul 26 21:13 vendor_data.json
-r--r--r--  1 root wheel   14 Jul 26 21:13 vendor_data2.json
root@freebsd-14-test:/ #

Note there is no user_data.json file. The result is that no freebsd user is created, and no ssh key added. This has broken since this change was added:

https://cgit.freebsd.org/src/commit/libexec/nuageinit/nuageinit?id=48edad2edf6eb7a539e40dad8e1f87e3fa4973fd

Reverting it fixes the problem.

For reference here's the content of meta_data.json (formatted and unique data removed):

root@freebsd-14-test:/ # jq < /mnt/openstack/latest/meta_data.json
{
  "uuid": "uuid_for_this_instance",
  "admin_pass": "a_generated_password",
  "public_keys": {
    "tdb": "ssh-ed25519 my_key_id tdb@host"
  },
  "keys": [
    {
      "name": "tdb",
      "type": "ssh",
      "data": "ssh-ed25519 my_key_id tdb@host"
    }
  ],
  "hostname": "freebsd-14-test.novalocal",
  "name": "freebsd-14-test",
  "launch_index": 0,
  "availability_zone": "nova",
  "random_seed": "long_random_seed",
  "project_id": "my_project_id",
  "devices": [],
  "dedicated_cpus": []
}
root@freebsd-14-test:/ #

So, for me, the simple fix seems to be to revert that commit.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2024-07-27 12:35:38 UTC
^Triage: over to the committer of revision in question.
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-08-20 10:12:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=19fb9ad746517c7af9d79a982334b2550f285355

commit 19fb9ad746517c7af9d79a982334b2550f285355
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-08-20 10:04:01 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-08-20 10:08:29 +0000

    nuageinit: readd ssh key parsing when key is in meta_data.json

    in openstack when no user is specified but a sshkey is provided
    the information is stored in meta_data.json under "public_keys"

    PR:     280461
    Reported by:    tdb

 libexec/nuageinit/nuageinit          |  6 +++++
 libexec/nuageinit/tests/nuageinit.sh | 48 ++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-09-03 07:09:07 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=3a73c77f2d862f2754483ab26e252befc4f8f4e6

commit 3a73c77f2d862f2754483ab26e252befc4f8f4e6
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-08-20 10:04:01 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-09-03 07:05:24 +0000

    nuageinit: readd ssh key parsing when key is in meta_data.json

    in openstack when no user is specified but a sshkey is provided
    the information is stored in meta_data.json under "public_keys"

    PR:     280461
    Reported by:    tdb

    (cherry picked from commit 19fb9ad746517c7af9d79a982334b2550f285355)

 libexec/nuageinit/nuageinit          |  6 +++++
 libexec/nuageinit/tests/nuageinit.sh | 48 ++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
Comment 4 Tim Bishop freebsd_committer freebsd_triage 2024-09-11 20:16:05 UTC
Tested on 14.1-STABLE snapshot image and can confirm that it now works correctly.

FreeBSD-14.1-STABLE-amd64-BASIC-CLOUDINIT-20240905-4938f554469b-268665.ufs.raw.xz

Thank you!
Comment 5 Tim Bishop freebsd_committer freebsd_triage 2024-09-11 20:16:07 UTC
Tested on 14.1-STABLE snapshot image and can confirm that it now works correctly.

FreeBSD-14.1-STABLE-amd64-BASIC-CLOUDINIT-20240905-4938f554469b-268665.ufs.raw.xz

Thank you!