=== hi is now known as Guest3228 | ||
faa | TomasD: freebsd default only sample cobfig, cp cloud.cfg.d/05_logging.cfg.sample cloud.cfg.d/05_logging.cfg | 08:39 |
---|---|---|
faa | NoCloud perfect work with iso, example sysutils/cbsd | 08:40 |
gnawa | 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:23 |
gnawa | the oly useful variables fouynd in /sys/class/dmi/id are product_serial and product_uuid | 15:24 |
gnawa | but I can't see any corrispondence with the variables llisted in the table.. | 15:24 |
gnawa | I tried __dmi.system-uuid__ --> product_uuid | 15:25 |
gnawa | and __dmi.system-serial-number__ --> product_serial | 15:28 |
gnawa | but it didn't worked.. | 15:28 |
gnawa | ah I also tried to use __dmi.chassis-serial-number__ --> chassis_serial | 15:29 |
gnawa | is there anyone who can help me ? thank you (sorry for the typos I burnt two fingers in a pitfire yesterday..) | 15:31 |
gnawa | 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:45 |
gnawa | and my PXE config stanza is like: | 15:46 |
gnawa | 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 --- | 15:46 |
gnawa | 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 |
gnawa | https://github.com/canonical/cloud-init/blob/main/cloudinit/dmi.py | 16:04 |
gnawa | "system-uuid": KernelNames("product_uuid", "smbios.system.uuid"), | 16:05 |
gnawa | "system-serial-number": KernelNames("product_serial", "smbios.system.serial") | 16:06 |
gnawa | "chassis-serial-number": KernelNames( "chassis_serial", "smbios.chassis.serial" | 16:06 |
meena | you're looking at very fresh, unreleased code | 16:22 |
meena | gnawa: unless you're actually running git HEAD, please go look at the corresponding tag for the code causing trouble | 16:22 |
gnawa | thank you meena , where I can find the tag ? I know only the version ov cloud-init: | 16:25 |
gnawa | root@ubuntu-server:/var/log# cloud-init --version | 16:25 |
gnawa | usr/bin/cloud-init 22.2-0ubuntu1~22.04.3 | 16:26 |
gnawa | oh okay the release tag | 16:27 |
gnawa | now I see it | 16:27 |
minimal | gnawa: what version fo cloud-init are you using? | 17:00 |
gnawa | cloud-init 22.2-0ubuntu1~22.04.3 | 17:01 |
minimal | gnawa: the dmi variable support was only recently added to git main, it is not present in any release yet | 17:01 |
minimal | so this functionality will appear in cloud-init 23.1 whenever it is released around February/March time | 17:03 |
gnawa | ok got it, thank you! | 17:07 |
minimal | gnawa: so the document for the version you are running is~: https://cloudinit.readthedocs.io/en/22.2/topics/datasources/nocloud.html | 17:07 |
minimal | 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:08 |
gnawa | thank you minimal, I understand my mistake ... | 17:13 |
minimal | gnawa: you weren't the person trying the same dmi stuff on Alpine Linux a few days ago? | 17:31 |
gnawa | minimal no it wasn't me | 17:32 |
minimal | ah ok, they asked the same question but don't seem to have come back to see if anyone answered | 17:33 |
minimal | 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:46 |
meena | aye, i haven't mocked away all of those yet | 17:57 |
meena | minimal: my ifconfig parser gets initialised in BSDNetworking, which gets instantiated in FreeBSD distro class. that instantiation calls ifconfig -a | 17:58 |
minimal | meena: yes, so for my revised cc_ca_Certs.py its tests are failing due to an unexpected subp for "ifconfig -a" | 18:00 |
meena | you can mock it with an empty string, since you don't care about networking paths | 18:02 |
meena | 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:03 | |
meena | however, i think i have examples there doing only the initialisation with an empty string | 18:04 |
minimal | 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:04 |
meena | see with mock | 18:06 |
minimal | e.g. some testcases when testing freebsd will expect to see a subp for "certctl" | 18:06 |
meena | that's usually where the instantiation happens | 18:06 |
meena | have not figured out yet, how to do that in python | 18:08 |
minimal | 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:10 |
minimal | tox shows AssertionError: Unexpectedly used subp.subp | 18:11 |
minimal | that testcase does nothing with subp at all | 18:11 |
meena | that's annoying, let's see how to best fix it | 18:22 |
meena | https://github.com/canonical/cloud-init/blob/main/tests/unittests/config/test_cc_ca_certs.py#L169 in here, i'd do: | 18:24 |
meena | this: https://github.com/canonical/cloud-init/blob/main/tests/unittests/config/test_cc_power_state_change.py#L89 | 18:25 |
meena | minimal: that make sense? | 18:26 |
minimal | ok, let me try that | 18:33 |
meena | the basic idea is: if it's network related, load in the appropriate ifconfig asset, if not, load '' | 18:38 |
minimal | ok, that seems to have done it, I added this: | 18:54 |
minimal | + if distro_name == 'freebsd': | 18:54 |
minimal | + mock.patch( | 18:54 |
minimal | + "cloudinit.distros.networking.subp.subp", | 18:54 |
minimal | + return_value=("", None), | 18:54 |
minimal | + ) | 18:54 |
meena | no with mock.patch? hmm, yeah, i guess | 18:56 |
minimal | that's using mock.patch | 18:58 |
meena | I might see if any of the mocks i added need the "with" | 18:59 |
meena | minimal: su what's your patch look like? | 20:31 |
minimal | meena: patch to fix the freebsd issue or the patch in general? | 20:57 |
meena | minimal: general | 22:28 |
minimal | 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:36 |
minimal | I'm currently testing it locally for alpine, then have to run a fedora VM to verify that | 22:37 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!