meena | this is a crime: https://github.com/igalic/cloud-init/pull/new/bsd/device_drivers | 00:55 |
---|---|---|
meena | aciba: 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_drivers | 10:45 |
meena | better match: r"""ifconfig_([^_]+?)_name="?{}"?""".format(devname) | 11:06 |
meena | still pretty horrible, but more stable. | 11:06 |
meena | i know that BSD sh allows : in function names, probably also in variable names… | 11:07 |
meena | $ export ifconfig_vtnet0:2_name="eth2" | 11:07 |
meena | export: ifconfig_vtnet0:2_name: bad variable name | 11:07 |
aciba | meena: 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 |
aciba | meena: is that naming documented/specified somewhere ? | 11:37 |
meena | i'm currently trying to find out where that vtnet0:2 stuff even comes from, I've never seen that on BSD | 11:38 |
meena | i don't see it in the handbook, in the man page, in any of the example outputs i got from people. | 11:50 |
meena | aciba: but, yeah, it's a design question: how do i design: get_rc_config_line(regex, fn="/etc/rc.conf")? | 11:54 |
meena | currently, 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 group | 11:54 |
aciba | meena: 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 |
aciba | we 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 |
meena | I like that. | 12:14 |
meena | also the split above makes it easy to target | 12:14 |
meena | and i would just go: if match: return line | 12:15 |
meena | I need to look into the Linux device_driver() implementation. I wonder if that can return None | 12:16 |
holmanb | meena: Are you developing cloud-init on freebsd? | 18:13 |
holmanb | rather, 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 |
meena | holmanb: mostly libvirt on an Ubuntu to test right now | 18:26 |
meena | when i have better changes, I'll need to test them on real clouds | 18:27 |
meena | the blacklist driver stuff is mostly for azure, but threading that thru will require refactoring a lot | 18:28 |
holmanb | gotcha | 18:28 |
holmanb | Just wanted to give a heads up that we landed a qemu tutorial that might be usable on BSDs (haven't tested). | 18:34 |
holmanb | I 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!