[07:08] <meena> holmanb: yes, but where would it fit into this picture: https://github.com/canonical/cloud-init/blob/main/WIP-ONGOING-REFACTORIZATION.rst
[12:47] <meena> holmanb: there's also an… well, two ifconfig parsers in netinfo.py 
[14:33] <holmanb> meena: the wip doc predates my involvement, I'm probably not the best person to answer that since I was not involved in those discussions 
[14:34] <holmanb> phunyguy: thanks for the ping, I'll get back to you on the PR today, haven't taken a look yet sorry
[18:14] <meena> holmanb: yeah, one of the main people involved is no longer in Canonical… but blackboxsw and rharper (and probably smoser as one of the authors of netinfo.py) should have some clue where best to put it… and what to do with netinfo.py…
[19:02] <ananke> so here's a fun frustrating discovery this morning: ubuntu uses /bin/dash as 'sh', which does NOT have 'source'
[19:02] <ananke> so some of my runcmd was failing because of that
[19:18] <holmanb> ananke: don't most linux distros run dash these days?
[19:19] <ananke> holmanb: not that I'm aware of, only debian/ubuntu based ones
[19:19] <minimal> holmanb: apart from Alpine which uses Busybox sh which is basically "ash"
[19:19] <ananke> rhel/fedora/suse/sles/etc don't use dash
[19:21] <minimal> ananke: isn't "source" not a POSIX thing and the POSIX way is "."?
[19:21] <ananke> on distros that link /bin/sh to bash, and execute bash in bourne shell compatibility mode that way, 'source' works. not a big deal, I will switch to `.`, but it was a frustrating to debug
[19:21] <ananke> minimal: correct
[19:22] <minimal> ananke: so /bin/sh is supposed to be POSIX-compatible - if you want to use "source" then put "/bin/bash" at the top of your scripts
[19:22] <holmanb> ananke: my bad, there was some discussion post-shellshock about switching to dash, I guess that never happened
[19:23] <ananke> minimal: that's the thing, I'm not putting anything at the top of my scripts, this is runcmd module doing it
[19:23] <minimal> ananke: also try using "shellcheck" to validate your scripts for correctness?
[19:24] <minimal> ananke: hmm, ok, I don't think I've ever uses "runcmd" on a script without a shebang line specified
[19:24] <ananke> minimal: runcmd accepts individual commands as input, and creates its own script
[19:27] <holmanb> ananke: how about this then?
[19:27] <holmanb> runcmd:
[19:27] <holmanb>   - [ "bash", "-c", "source whatever; <rest of script>"]
[19:27] <minimal> ananke: yeah, was getting mixed up with write_files for script creation
[19:28] <holmanb> when passed as a list of args, it should be like execve, rather than `sh`
[19:28] <ananke> holmanb: it's not a problem anymore, because I identified the root cause. so using '.' works
[19:29] <ananke> I was simply sharing something that may be of interest to others. a simple '- source something' in runcmd works on rhel/centos/amazon linux/suse/etc, but not on debian/ubuntu
[19:30] <holmanb> ananke: Sounds good, glad you got it sorted. TIL thanks for sharing :-)
[19:30] <minimal> for any Unix-like system the only assumption is that /bin/sh exists and it is POSIX-compatible, it would be complicated for cloud-init to try to be smarter
[19:32] <ananke> minimal: right, it's my fault for not writing it correctly in the first place. I partly blame bash for not working as expected when running in sh compatibility mode, because I would have caught it much earlier
[19:37] <minimal> Bash's POSIX mode apparently does support "source" in some fashion according to points 30 & 42 here: https://www.gnu.org/software/bash/manual/html_mode/Bash-POSIX-Mode.html
[19:48] <ananke> interesting side note. runcmd docs on https://cloudinit.readthedocs.io/en/latest/topics/modules.html#runcmd mention:  'when writing files, do not use /tmp dir as it races with systemd-tmpfiles-clean LP: #1707222. Use /run/somedir instead.'
[19:49] <ananke> it's worth pointing out that some distros mount /run with noexec
[19:50] <meena> for what it's worth: FreeBSD sh doesn't know about source either
[20:02] <meena> alias source=.
[20:02] <meena> works…
[20:16] <ananke> meena: so does '.' :)
[20:47] <smoser> ananke: please dont rely on the fact that runcmd puts all commands into a single shell file that maintains state across entries in runcmd.
[20:48] <smoser> that was a bad implementation choice.
[20:48] <smoser> those who made such a choice shall remain anonymous.
[20:51] <ananke> smoser: thank you for that hint, I may have to rethink some of our approach
[20:52] <smoser> ananke: you can do all sorts of things with yaml to make it palatable
[20:52] <ananke> vast majority of code we execute via cloud-init is stored in files, written by cloud-init, so it's not an issue. the reason why I'm doing some stuff via runcmd is it's ad-hoc nature, and more importantly: it runs as the very last step
[20:59] <smoser> ananke: https://pastebin.com/raw/y0nGTsWV . i feel dirty for using pastebin.com, but that is something i woudl do in user-data. it makes heavy use of yaml anchors to make things more readable.
[21:11] <ananke> smoser: cheers, that will be very helpful
[21:12] <ananke> it's quitting time though, so this will have to wait until the morning. along with trying to figure out why my runcmd stuff is executed twice.