/srv/irclogs.ubuntu.com/2024/07/25/#cloud-init.txt

=== benj_0 is now known as benj_
dchI'm writing up some notes on how to *test* cloudinit, specifically on FreeBSD, using jails.10:05
dchis there a clever trick (tm) where people can drop their user-data file, and pass this in as a parameter somehow?10:05
dchI have already used `cloud-init schema --annotate -c /var/tmp/userdata` , so something similar10:06
dchI have tried using DataSource NoCloud and None, and then running `cloud-init --debug init --local` per https://cloudinit.readthedocs.io/en/latest/reference/datasources/nocloud.html without success13:13
dchaha there is a subtle error in https://cloudinit.readthedocs.io/en/latest/reference/datasources/nocloud.html#method-4-local-filesystem a missing `/` makes the path relative, not absolute13:40
minimalisn't that how file references work in general? If they don't begin with "/" then they're relative14:07
minimaldch: it's not clear exactly what you're referring to14:09
dchminimal: now I'm past getting NoCloud to work, my original issue is fixed.14:10
dchIMHO the example in the docs should use an absolute path, not a relative one.14:10
dchI will log a ticket for it14:11
minimaldch: which example?14:11
dchhttps://cloudinit.readthedocs.io/en/latest/reference/datasources/nocloud.html#method-4-local-filesystem 14:11
dch`seedfrom: file://10.42.42.42/cloud-init/configs/` should use `file:///...`14:11
minimalwhich example specifically in that section?14:11
dchthat string occurs only once14:11
minimalok, I wondered if it was the file url was the issue14:12
dchits *super handy* using this for testing, in CI or just locally.14:12
minimalalso the "seedfrom" example there is incorrect as the url includes host IP14:13
dchyeah its a bit of a weird copypasta I guess14:18
=== benj_2 is now known as benj_
dchso everything with NoCloud works as expected on 23.3, but ... 24.1.4 it appears to be broken.16:43
dchI have found a few similar looking issues in github, so will try with git master and hope for the best.16:44
minimaldefine "broken", also note that 24.2 came out a few weeks ago16:44
dchNoCloud datasource appears not to run16:44
dchand it still tries to fetch the network related ones16:45
dchit's going to take me a while to put up a proper issue for this16:45
minimalcheck /var/log/cloud-init.log to see what happened?16:45
minimalin there you'll see which DataSources cloud-init considered using and which one it settled on16:46
dchhttps://gist.githubusercontent.com/dch/a7c0c546fba7f65240fb681c5f1c9f1d for details16:51
dchit just seems to settle on OpenStack with no explanation16:51
dch2024-07-25 16:48:33,540 - main.py[DEBUG]: No local datasource found16:53
minimalLooking for data source in: ['OpenStack', 'None'], via packages ['', 'cloudinit.sources'] that matches dependencies ['FILESYSTEM']16:53
minimalso it only checks OpenStack and None16:53
minimalthat would be baed on any datasources_list definition in /etc/cloud/cloud.cfg or inside /etc/cloud/cloud.cfg.d/ typically16:54
dchthere are no datasources_list anywhere16:56
dchis there some code-based default?16:56
minimalyes, lemme find it16:56
dchtyvm16:56
dchdatasource_list: [ NoCloud, None ]16:56
dchI should be able to add this to my 00_nocloud.cfg file then.. let's see16:57
dchit still seems to ignore the `network: disabled` line in my 00_nocloud.cfg tho16:58
minimalin /usr/lib/python3.12/site-packages/cloudinit/settings.py (or similar path)16:59
minimalthe definition of datasource_list16:59
dchok its not coming from that, this is the same as the release version17:00
minimalhow did you get (or create) the OS you're booting?17:01
minimalids this a VM using an official freebsd cloud disk image?17:01
dchits a fresh container specifically for troubleshooting ci17:01
dchso yes its 100% "normal" freebsd17:01
minimalcontainer? created how?17:02
dchhow well do you know freebsd? if not, just trust me, its vanilla17:02
minimalI'm not even sure if cloud-init on FreeBSD supports containers or not17:02
minimalthge "resident" cloud-init FreeBSD isn't in this channel currently17:03
minimals/FreeBSD/FreeBSD person/17:03
dchI know them well, they're taking a well deserved break17:03
dchzfs clone zroot/jails/templates/14.1-RELEASE-amd64-amd64@ready zroot/jails/instances/14.1-RELEASE-amd64-amd64/clowninit17:03
minimalbasically I'd expect the default list of DataSources to be used unless it is being overridden inside /etc/cloud/17:04
dchyes thats what I see here too17:04
dchI don't think the /usr/local/etc/cloud/cloud.cfg.d/ files are being processed properly17:05
dchI can see they're read in the log17:05
dch2024-07-25 16:58:17,782 - util.py[DEBUG]: Reading from /usr/local/etc/cloud/cloud.cfg.d/00_nocloud.cfg (quiet=False)17:05
dchbut somehow that data no longer ends up in the final merged config17:06
minimaloh hang on, does cloud-init on FreeBSD use ds-identify?17:08
dchyes, but we fixed that running in ~ 2023 IIRC17:08
minimalif it does then it's likely an issue in there17:08
minimalcloud-init only decides a list of DSes (whether default or otherwise) if ds-identify doesn't provide it with a list17:09
dchhttps://www.irccloud.com/pastebin/EznjjOis/ds-identify.log17:10
dchok I found ds-identify.log now17:10
dchNoCloud is in the DSLIST and in the defaults17:10
dchso does ds_identify not handle files in /usr/local/etc/cloud/cloud.cfg.d/*.cfg perhaps?17:11
minimallook at the last couple of lines17:11
dchanother yaml-in-shell-script footgun17:11
minimalAFAIK /etc/cloud/ is only used by cloud-init "proper"17:12
minimal2nd last line: "1 datasources returned maybe: OpenStack"17:12
dchso, moving the 00_nocloud.cfg contents into cloud.cfg *directly* now works17:13
dchDSLIST=NoCloud None17:13
dchdsidentify should never have been written in shell17:14
minimalfrom a quick look at ds-identify I see it can detect FreeBSD jails17:15
dchyes cloudinit has nothing to do with jails really17:15
minimalbut I don't see any indication of which datasource will be selected when in a jail17:15
dchits simply broken if there is a merged config in cloud.cfg.d/*17:15
dchwould that work on linux either?17:16
dchwe set PATH_ETC_CLOUD but not PATH_ETC_CI_CFG_D=17:17
minimalwould what work? I use multiple files in /etc/cloud/cloud.cfg.d/ on Linux all the time and it works17:17
dchexactly that17:17
minimale.g. when I create disk images for specfic DSes I have a file in /etc/cloud/cloud.cfg.d/ to override the datasources_list17:18
dchand on FreeBSD this directory should point to /usr/local/etc/cloud.cfg.d/ instead17:18
dchwhich is why this isn't being picked up17:18
minimalI think the issue is that ds-identify when it encounters a jail doesn't decide what datasource(s) should apply for the jail17:19
dchno it has nothing to do with a jail17:19
dchits simply looking at /etc/cloud/cloud.cfg.d instead of /usr/local/etc/cloud/cloud.cfg.d17:19
minimalds-identify doesn't look there at all AFAIK17:19
minimalif you look at dscheck_NoCloud in ds-identify it checks DMI serial for "ds=nocloud="17:20
minimalit also checks for seed dir etc17:21
dchif I move /usr/local/etc/cloud/cloud.cfg.d in /etc/cloud/ this works17:21
dchso the issue is earlier - its not identifying the seed dir correctly because its not reading the right config files17:21
minimalit works because you've enable cloud-init itself to use the override you provide? that's a separate issue from whether ds-identify first doesn't detect NoCloud17:22
dchbbl, gotta feed the fam17:22
minimalthere are 2 distinct actions here17:22
dchyes dsidentify should run first. the shell script is looking in the wrong place. if I use the linux dir, this part succeeds.17:23
minimal(1) is ds-identify detecting correctly? (2) is cloud-init reading config files from right place17:23
dchbut, then during "normal" cloudinit, this is now broken and doesn't read the seed. 17:23
minimalso has the ds-identify script in FreeBSD been modified to use the /usr/local/etc/cloud path?17:28
minimalor variables like PATH_ETC_CLOUD, PATH_ETC_CI_CFG and PATH_ETC_CI_CFG_D set before ds-identify is run to override the defaults to /usr/local/...17:30
dchback17:56
dchmore the latter17:56
dchcurrently just these 3 variations, mina has upstreamed the rest already17:57
dchhttps://cgit.freebsd.org/ports/tree/net/cloud-init/files17:57
dchthese small remaining patches allow people to relocate all of /usr/local to whereever they fancy like /opt/mystuff or whatever17:58
dchso not really relevant17:58
minimalI'm confused as to what the issue is - if FreeBSD is using /usr/local/etc/cloud prefix instead of /etc/cloud then shouldnt' the FreeBSD "package" of cloud-init change all references accordingly?18:15
=== arif-ali_ is now known as arif-ali
dchTLDR yes. but these settings are encoded in cloudinit itself, this is not the problem.21:23
dchafter a bit more refining, the issue is that:21:23
dchdsidentify can parse `datasource_list: ['k', v']` but not the same thing when it is spread over more than 1 line, which is both valid yaml, and canonical (ie formatters will print it that way)21:24
dchand thats what is causing /etc/cloud.cfg.d/00_nocloud.cfg to not be read21:25
dchand probably other things too, but this has lost me from 10:00 to 21:30 today with a couple hours off for food/family21:26
dchand similar lost time last year when dsidentify was introduced21:26
dchmaybe dsidentify could just borrow python to handle the yaml correctly? shell is not our friend here21:27
minimaldch: oh "that", I thought that was fixed in ds-identify some time ago22:02
dchno, just finished checking in 24.2 and its still problematic22:07
minimaldch: you missing the comment in /etc/cloud/cloud.cfg about using a single line? lol22:30
dchyes I made the mistake of just reading the docs, and not modifying the main file22:31

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!