=== hi is now known as Guest3228 [08:39] TomasD: freebsd default only sample cobfig, cp cloud.cfg.d/05_logging.cfg.sample cloud.cfg.d/05_logging.cfg [08:40] NoCloud perfect work with iso, example sysutils/cbsd [15:23] Hello, I'm trying to load user-data and meta-data expanding dmi variables as seen in the manual --> https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html [15:24] the oly useful variables fouynd in /sys/class/dmi/id are product_serial and product_uuid [15:24] but I can't see any corrispondence with the variables llisted in the table.. [15:25] I tried __dmi.system-uuid__  --> product_uuid [15:28] and __dmi.system-serial-number__ --> product_serial [15:28] but it didn't worked.. [15:29] ah I also tried to use __dmi.chassis-serial-number__ --> chassis_serial [15:31] is there anyone who can help me ? thank you (sorry for the typos I burnt two fingers in a pitfire yesterday..) [15:45] the cloud-init log shows: 2023-01-01 15:37:26,739 - DataSourceNoCloud.py[DEBUG]: Seed from http://pxe.gnawa.lan/pxelinux.cfg/__dmi.chassis-serial-number__/ not supported by DataSourceNoCloud [seed=None][dsmode=net] [15:46] and my PXE config stanza is like: [15:46] append url=http://pxe.gnawa.lan/images/ubuntu-22.04.1-live-server-amd64.iso autoinstall ds=nocloud-net;s=http://pxe.gnawa.lan/pxelinux.cfg/__dmi.chassis-serial-number__/ cloud-config-url=/dev/null ip=dhcp fsck.mode=skip --- [16:04] mm okay it looks like the corrispondences between cloud-init variables and dmi values present in /sys/class/dmi/id are correct... as shown by the source code of dmi.py [16:04] https://github.com/canonical/cloud-init/blob/main/cloudinit/dmi.py [16:05] "system-uuid": KernelNames("product_uuid", "smbios.system.uuid"), [16:06]     "system-serial-number": KernelNames("product_serial", "smbios.system.serial") [16:06] "chassis-serial-number": KernelNames( "chassis_serial", "smbios.chassis.serial" [16:22] you're looking at very fresh, unreleased code [16:22] gnawa: unless you're actually running git HEAD, please go look at the corresponding tag for the code causing trouble [16:25] thank you meena , where I can find the tag ? I know only the version ov cloud-init: [16:25] root@ubuntu-server:/var/log# cloud-init --version [16:26] usr/bin/cloud-init 22.2-0ubuntu1~22.04.3 [16:27] oh okay the release tag [16:27] now I see it [17:00] gnawa: what version fo cloud-init are you using? [17:01] cloud-init 22.2-0ubuntu1~22.04.3 [17:01] gnawa: the dmi variable support was only recently added to git main, it is not present in any release yet [17:03] so this functionality will appear in cloud-init 23.1 whenever it is released around February/March time [17:07] ok got it, thank you! [17:07] gnawa: so the document for the version you are running is~: https://cloudinit.readthedocs.io/en/22.2/topics/datasources/nocloud.html [17:08] the documentation site defaults to "latest" which reflects the git "main~" branch, you need to select the version you are using to see its dos [17:13] thank you minimal, I understand my mistake ... [17:31] gnawa: you weren't the person trying the same dmi stuff on Alpine Linux a few days ago? [17:32] minimal no it wasn't  me [17:33] ah ok, they asked the same question but don't seem to have come back to see if anyone answered [17:46] meena: I'm seeing test failures when I enable freebsd for the modified cc_ca_certs.py that I have here - but the failures are unrelated to any certificate stuff, when the test harness "get_cloud" function (in tests/unittests/util.py) is called for "freebsd" it ends up trying to do a "ifconfig -a" for some reason - seems to be related to cloudinit/distros/networking class BSDNetworking being called [17:57] aye, i haven't mocked away all of those yet [17:58] minimal: my ifconfig parser gets initialised in BSDNetworking, which gets instantiated in FreeBSD distro class. that instantiation calls ifconfig -a [18:00] meena: yes, so for my revised cc_ca_Certs.py its tests are failing due to an unexpected subp for "ifconfig -a" [18:02] you can mock it with an empty string, since you don't care about networking paths [18:03] https://github.com/canonical/cloud-init/pull/1779 [18:03] -ubottu:#cloud-init- Pull 1779 in canonical/cloud-init "Net: add BSD ifconfig(8) parser and state class" [Merged] [18:04] however, i think i have examples there doing only the initialisation with an empty string [18:04] some of those testcases do use/check subp for certs purposes so I'd need to change those to also expects "ifconfig -a" for freebsd [18:06] see with mock [18:06] e.g. some testcases when testing freebsd will expect to see a subp for "certctl" [18:06] that's usually where the instantiation happens [18:08] have not figured out yet, how to do that in python [18:10] so for example the 1st test to fail is TestConfig.test_correct_order_for_remove_then_add in tests/unittests/config/test_cc_ca_certs.py [18:11] tox shows AssertionError: Unexpectedly used subp.subp [18:11] that testcase does nothing with subp at all [18:22] that's annoying, let's see how to best fix it [18:24] https://github.com/canonical/cloud-init/blob/main/tests/unittests/config/test_cc_ca_certs.py#L169 in here, i'd do: [18:25] this: https://github.com/canonical/cloud-init/blob/main/tests/unittests/config/test_cc_power_state_change.py#L89 [18:26] minimal: that make sense? [18:33] ok, let me try that [18:38] the basic idea is: if it's network related, load in the appropriate ifconfig asset, if not, load '' [18:54] ok, that seems to have done it, I added this: [18:54] + if distro_name == 'freebsd': [18:54] + mock.patch( [18:54] + "cloudinit.distros.networking.subp.subp", [18:54] + return_value=("", None), [18:54] + ) [18:56] no with mock.patch? hmm, yeah, i guess [18:58] that's using mock.patch [18:59] I might see if any of the mocks i added need the "with" [20:31] minimal: su what's your patch look like? [20:57] meena: patch to fix the freebsd issue or the patch in general? [22:28] minimal: general [22:36] meena: it's quite a few changes, fixing alpine/debian/ubuntu behaviour as it wasn't correct, likely fixing/changing rhel behaviour and adding freebsd support [22:37] I'm currently testing it locally for alpine, then have to run a fedora VM to verify that