/srv/irclogs.ubuntu.com/2024/01/22/#cloud-init.txt

anihey folks holmanb is the following syntax no longer supported?10:02
anidatasource_list:10:02
ani - Azure10:02
ani```datasource_list:10:02
ani - Azure```10:02
holmanbani: hi there, not sure i understand the question 15:01
holmanbThe python code in cloud-init understands the syntax, but ds-identify has always required that to be on a single line15:03
holmanbSo depends on your use case15:03
holmanbds-identify has a simple yaml parser in posix shell that can't handle multi-line lists15:04
aniSo previous to 23.4, that syntax worked but now it does not15:07
aniSo we are getting errors like https://privatebin.corp.redhat.com/?fb8a2678912a221e#7Ko77UsYQGt9uMKvrHUWPp95LMmgA9GUKTS9AcPLHfYa15:09
aniFor a config like15:09
anidatasource_list:15:09
ani - Azure15:09
aniI could not pin point specific change that introduced the behaviur change15:10
aniholmanb15:28
holmanbani: link doesn't work15:36
aniholmanb try now https://pastebin.com/49fr54iR16:42
holmanbani: thanks16:45
holmanblooks like the datasource_list maybe contains a list of type dict, not a str16:46
holmanbis there a stray colon after one of your list items (`- Azure:`) by chance?16:46
holmanbani: could you share the cloud.cfg causing this?16:47
aniholmanb https://pastebin.com/Lz9jahUc16:52
animore complete one is https://pastebin.com/jBArHhnE16:53
aniLooking for data source in: [\\{'datasource_list': None}, 'None'], via packages ['', 'cloudinit.sources'] that matches dependencies ['FILESYSTEM', 'NETWORK']17:00
aniSo its actually a "{'datasource_list': None}"17:01
aniso parsing is not working very well17:01
blackboxswani, was that a paste the issue is that second paste? line 1, and 2 aren't indented in scope of the datasource configuration, so` datasource:` is an empty dict and `Azure:` is an empty dict17:02
blackboxswand apply_network_config isn't defined under `datasource:Azure:` yaml path17:03
aniI am not sure, I am pasting from out internal bug report raised by someone else. In any case, they are saying that changing line 4 to datasource_list: [ Azure ] makes it work17:05
aniwith 23.417:05
aniPreviously the same config was working on 23.1.117:05
holmanbto my knowledge datasource_list has always required single line configurations for ds-identify17:08
holmanbwas rhel using ds-identify prior to 23.4?17:08
minimalholmanb: the example in RTD does have a comment: "# If you use datasource_list array, keep array items in a single line."17:09
holmanbminimal: exactly17:09
aniThat is recent17:09
minimal"If you use multi line array, ds-identify script won't read array items."17:09
animultiline lists  used to work before17:09
aniand also the config I shared17:09
anithat is why I am wondering what changed and from which commit17:10
aniyes rhel was using ds-identify afaik17:10
holmanbthat comment in the templated config is 3 years old17:11
minimalAlso the warning here: https://cloudinit.readthedocs.io/en/latest/reference/base_config_reference.html#datasource-list 17:12
minimal"This key is unique in that it uses a subset of YAML syntax. It requires that the key and its contents, a list, must share a single line - no newlines."17:12
minimalblackboxsw: your comment about lines 1 & 2 do confuse me, based on the docs I don't see "datasource:" needing to be indented, isn't it at the same "level" as datasource_list?17:14
aniyes but I am not sure why it worked before and now it does not17:14
holmanbani: that's why I ask if ds-identify is a new addition to rhel17:15
aniafaik we have not changed anything17:15
blackboxswminimal: sorry about that, the comment I had meant should have been 2 & 3. the keys that should have been nested under "datasource:" top-level key... which should be top-level key just like datasource_list:17:15
holmanbani: because if ds-identify was added between 23.1.1 and 23.4 it would have "worked" before, but not now17:15
blackboxswI can also confirm that the multi-line datasource_list config (as doc'd/warned) is silently ignoring /etc/cloud/cloud.cfg.d  containing `datasource_list:\n- Azure\n`  ... 17:16
aniok well ignoring but not failing the way I showed in the pastebin17:17
blackboxswand agreed w/ brett/minimal that this behavior in ds-identity has been there a long time as the shell script doesn't parse proper multi-line yaml in this case. 17:17
aniso I am not sure what is the difference in our case17:17
aniI guess we caught this isseu because of the failure17:18
aniif it had ignored it silently we would not see the issue17:18
aniso maybe it was ignoring the config silently before and now it crashes17:18
holmanbani - I'm guessing that this is just a different failure path than before17:19
holmanbwithout selecting the datasource, cloud-init would not have actually been running before either17:19
holmanbor maybe it fell back to datasourcenone automatically before, but that's still not correct behavior17:20
holmanbminimal: +1 for referencing fresh docs :-)17:21
blackboxswand agreed w/ brett/minimal that this behavior in ds-identity has been there a long time as the shell script doesn't parse proper multi-line yaml in this case. and agreed that it's been there since 2017 so it's something in external configuration on the image that is now aware of this condition (by running ds-identify during systemd generator timeframe now).   17:21
holmanbI think that warning landed in the docs just a week or two ago 17:21
aniexactly17:22
anibut you are saying that the behavior was there for a while17:22
blackboxswani yes, if systemd generator wasn't using ds-identify before, cloud-init python code would fallback to packaged datasource_list defaults which would generally be the full list of all supported datasources and the DataSource.get_data for each subclass would be called to see if it could correctly identify any viable datasource.17:22
holmanbthe behavior has existed for as long as ds-identify has been in use - and the comment warning of that misconfiguration has existed for 3 years 17:23
aniSo in summary I think we simply had a bad config that was somehow getting ignored up until now and it now crashes because of it17:24
holmanbani: I would suspect that it crashed before as well, but crashed in a different way.17:24
holmanbani: but otherwise yes that sounds about right17:25
aniok17:25
=== holmanb changed the topic of #cloud-init to: 23.3 Released 08/28 | File bug: https://github.com/canonical/cloud-init/issues/new/choose | PRs: https://git.io/JeVed | release schedule: https://discourse.ubuntu.com/t/2024-cloud-init-release-schedule/41679

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