/srv/irclogs.ubuntu.com/2023/03/22/#cloud-init.txt

minimalblackboxsw: BTW which bootloader are you using? out of interest I tried forcing metadata_csum_seed when creating a disk image using an older version of mkfs.ext4 and it turns out that Grub doesn't support that00:34
greatgatsby_Hi.  When I use the jinja template header, my config raises a schema warning.  Here, I just copied the example directly from the cloud-init docs:12:26
greatgatsby_https://bpa.st/TQFIW12:27
aciba[m]Hi gratgatsby_, the schema command operates on already rendered cloud-configs https://cloudinit.readthedocs.io/en/latest/reference/cli.html#schema12:34
aciba[m]to validate the rendered config on the system: sudo cloud-init schema --system12:34
aciba[m]to manually render a config: cloud-init devel render ...: https://cloudinit.readthedocs.io/en/latest/reference/cli.html#render12:35
greatgatsby_aciba[m]: thanks for the reply.  I'm pushing something like this out in my openstack vendordata and I get that warning in my cloud-init logs.  I personally don't care too much, but it kind of stands out for our clients.12:35
greatgatsby_aciba[m]: yes, if I run `cloud-init schema --system` I get the same warning12:36
aciba[m]I see, if the warning is the logs, I guess cloud-init should at least skip schema validation on ## template: jinja and other valid headers12:41
greatgatsby_appreciate the help, still testing here, and still quite possibly a pebkac12:43
aciba[m]greatgatsby_: we added schema validation for vendordata recently: https://github.com/canonical/cloud-init/commit/bb414c7866c4728b2105e84f7b426ab81cc4bf4d12:45
-ubottu:#cloud-init- Commit bb414c7 in canonical/cloud-init "disk_setup: use byte string when purging the partition table (#2012)"12:45
aciba[m]wrong link, this is the correct one: https://github.com/canonical/cloud-init/commit/55686b977570a6de69bef51c1e1a9d452333995d12:46
-ubottu:#cloud-init- Commit 55686b9 in canonical/cloud-init "cli: schema also validate vendordata*."12:46
aciba[m]previously cloud-init didn't validate vendor-data and I guess jinja configs are not a common use-case for user-data12:47
aciba[m]greatgatsby_: would you mind reporting a bug? https://cloudinit.readthedocs.io/en/latest/howto/bugs.html12:49
greatgatsby_aciba[m]: will do, I'll keep testing a bit to make sure this isn't a red herring.  Just to be clear, we have a vendordata.json which contains a cloud-init key.  The value for that key is a cloud-config string which starts with the `## template: jinja` header.12:51
cjp256If I run pytest against one module test_azure.py a bunch of tests fail after the "optimize datasource detection" commit due to subp flagging is_container checks.  but If I instead run tests/unittests/sources it does not fail.  The fixture setup looks the same in both cases, any idea what I'm missing here?12:51
greatgatsby_aciba[m]: particularly for vendordata, we need jinja since this has to support all the various image distros and versions in our openstack environment12:55
aciba[m]cjp256: That's sound like there is some leak in the test suite execution / setup, and only works in a particular order.12:55
aciba[m]greatgatsby_: yes, that is going to work. The only problem is that cloud-init is issuing an invalid cloud-config warning in the logs that it is incorrect, IIUC.12:59
greatgatsby_correct, just wanted to make sure I was explaining myself correctly.  The cloud-config does execute correctly, it's just the warning.  Once I confirm this isn't something I'm doing wrong on my end, I'll submit a ticket.  Thanks for the help.13:00
greatgatsby_aciba[m]: appreciate the help, maybe I'm misunderstanding this warning, I had assumed it was my vendordata as that's all I'm providing.  cloud-init schema --system gives `File None needs to begin with "#cloud-config"`.  What is "File None" ?13:05
aciba[m]greatgatsby_: None sounds like a Python uninitialized variable, it should point to the file in question.13:12
greatgatsby_ok - so I found in the logs, cloud-init is writing an empty cloud-config.txt file.  In cloud-init schema.py if config_path is None, this is the file it loads and validates.  At least in the master branch, a None config_path doesn't seem supported anymore?13:25
greatgatsby_https://github.com/canonical/cloud-init/blob/ubuntu/22.4.2-0ubuntu0_22.04.1/cloudinit/config/schema.py#L61313:25
greatgatsby_anyway, just providing some info, I'm still not convinced this isn't something I'm doing wrong somewhere :-)13:25
greatgatsby_aciba[m]: sorry if I wasted any of your time, it's possible something changed during an upgrade and now openstack is pushing out an empty cloud-config.txt in the vendordata blob13:34
aciba[m]greatgatsby_: no worries! if you find anything wrong please report it so that it can get fixed, thanks :)13:38
holmanbcjp256: I don't see the same thing as you.21:27
holmanbcjp256: https://dpaste.org/OF6pu21:28
cjp256holmanb: running same command https://dpaste.org/OFC2021:36
holmanbheh, it looks like I broke a thing or two 21:38
cjp256mostly curious why running it as a directory works :D21:49
holmanbthat's very curious21:54
holmanbI would expect  test_aliyun.py and test_altcloud.py to run before test_azure.py, maybe something in one of them has unclean state that make this pass when running it as a directory?21:56
holmanbdoes it do the same with `tox -r -e py3 tests/unittests/sources/test_azure.py`?21:59
cjp256i forced azure to run first by using `tests/unittests/sources/test_azure.py tests/unittests/sources`... fixture setup looks the same and test sequence is the same so idk :D22:09
cjp256well that was interesting22:48
cjp256it's a combination of the lru_cache() on is_container() and test_smartos invoking get_smartos_environment() on module load https://github.com/canonical/cloud-init/blob/main/tests/unittests/sources/test_smartos.py#L134622:49
cjp256holmanb: ^22:50
cjp256holmanb: get_smartos_environment() calls sys.read_dmi_data() which invokes is_container() prior to fixture setup22:51
holmanbinteresting22:58
cjp256`pip install pytest-antilru` :D23:02
holmanbhehe23:02
holmanbcaching makes nearly everything more difficult to reason about and test23:02
holmanbalso loading caches at module load time is a recipe for mischief23:05
cjp256yeah pytest-antilru seems to work fine here, maybe worth adding to the project's test-requirements?23:06
cjp256looks like it wraps lru_cache before module imports so it can track the list of caches and clear them for every test run23:11
holmanbthat sounds like a decent idea to me23:11
holmanbpytest-antilru makes a test fail that previously didn't23:15
holmanband it looks like that test is incorrect23:15
cjp256ah, nice. I opened a PR to see how it'd fare, I have had other test problems that may be related too :D23:21
holmanbnevermind, I don't see the issue anymore23:24

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