/srv/irclogs.ubuntu.com/2022/12/07/#cloud-init.txt

meenathis is a crime: https://github.com/igalic/cloud-init/pull/new/bsd/device_drivers00:55
meenaaciba: good morning. I committed a crime, and I need some input on how bad it is https://github.com/igalic/cloud-init/pull/new/bsd/device_drivers10:45
meenabetter match:             r"""ifconfig_([^_]+?)_name="?{}"?""".format(devname)11:06
meenastill pretty horrible, but more stable.11:06
meenai know that BSD sh allows : in function names, probably also in variable names…11:07
meena$ export ifconfig_vtnet0:2_name="eth2"11:07
meenaexport: ifconfig_vtnet0:2_name: bad variable name11:07
acibameena: Good morning. I do not see problem with `ifconfig_([^_]+?)_name="?{}"?`. Another simplier option could be to split the string manually: `'ifconfig_vtnet0:2_name="eth2"'.split("ifconfig_")[-1].split("_name=")`11:37
acibameena: is that naming documented/specified somewhere ?11:37
meenai'm currently trying to find out where that vtnet0:2 stuff even comes from, I've never seen that on BSD11:38
meenai don't see it in the handbook, in the man page, in any of the example outputs i got from people.11:50
meenaaciba: but, yeah, it's a design question: how do i design: get_rc_config_line(regex, fn="/etc/rc.conf")?11:54
meenacurrently, being a regex, it returns and Optional[Match] object… (well, not explicitly, yet) so you know exactly what you getting, if you have a regex group11:54
acibameena: I would probably return an Optional[str], in that way the output type is not tied to the input type, and if we overload the input parameters (for example adding a new input param or type or a new function to find lines containing a str) then the output type would be more stable. But I do not have the context.12:04
meena👍12:09
acibawe could do `def get_rc_config_line(by_regex, fn="/etc/rc.conf") -> Optional[str]:` and in the future extend it to `def get_rc_config_line(by_regex=None, by_str=None, fn="/etc/rc.conf") -> Optional[str]:`12:12
meenaI like that.12:14
meenaalso the split above makes it easy to target12:14
meenaand i would just go: if match: return line12:15
meenaI need to look into the Linux device_driver() implementation. I wonder if that can return None12:16
holmanbmeena: Are you developing cloud-init on freebsd?18:13
holmanbrather, I'm mostly curious right now whether you run cloud-init _in_ a vm/container on a freebsd host and if so what tools you use (bhyve/qemu/etc)18:19
meenaholmanb: mostly libvirt on an Ubuntu to test right now18:26
meenawhen i have better changes, I'll need to test them on real clouds18:27
meenathe blacklist driver stuff is mostly for azure, but threading that thru will require refactoring a lot18:28
holmanbgotcha18:28
holmanbJust wanted to give a heads up that we landed a qemu tutorial that might be usable on BSDs (haven't tested).18:34
holmanbI know you have plenty of irons in the fire, so no pressure if you'd rather not :)18:35

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