UbuntuIRC / 2020 /09 /03 /#cloud-init.txt
niansa
Initial commit
4aa5fce
[08:06] <cocoadaemon> hello there, i'd have a few questions regarding how and where to place some user-data that should be run once only, on the first boot, and as early as possible, but after network, in order to reconfigure some database entries that contain IP addresses
=== hjensas is now known as hjensas|afk
=== hjensas|afk is now known as hjensas
[16:09] <beantaxi> Does anyone know why execution order is per-once, per-instance, per-boot? I would have expected decreasing frequency, or at least according to frequency in any order. Not most-least-middle. Thanks!
[16:10] <beantaxi> Btw I'm going according to the /etc/cloud/cloud.cfg on my EC2 VM, as well as what I'm seeing in my log.
[16:11] <smoser> beantaxi:i'm confused.
[16:11] <smoser> per-once : frequency == 1
[16:12] <smoser> per-instance: frequency = N, where N is the number of instances
[16:12] <smoser> per-boot: frequency = N + B (b number of boots)
[16:12] <smoser> so it is in increasing order of frequency, not most-least-middle
[16:16] <beantaxi> Ah sorry, I typed that wrong.
[16:17] <beantaxi> The above would be great ... but it's actually once - boot - instance. That is what I meant to type. My apologies.
[16:20] <beantaxi> https://pastebin.com/uPpErqJE
[17:28] <AnhVoMSFT> is the 20.4 SRU in xenial/bionic -proposed yet?
[17:28] <AnhVoMSFT> I mean 20.3
[17:29] <powersj> yes, you can always check https://launchpad.net/ubuntu/+source/cloud-init
[17:30] <powersj> or run `rmadison cloud-init` on ubuntu systems
[17:31] <blackboxsw> AnhVoMSFT: right, and falcojr3 has begun SRU testing. we're expecting to blitz a lot of that SRU validation tomorrow
[17:31] <AnhVoMSFT> Thanks @powersj @blackboxsw
[17:38] <beantaxi> AnhVoMSFT: I'm currently running 20.3 from bionic-proposed. So far so good.
[19:24] <Odd_Bloke> smoser: So if I set "manual_cache_clean: true" in user-data I'm passing to a lxd container, am I right in thinking that I should be able to unset this just by removing /var/lib/cloud/instance/manual-clean? (I've also modified the user-data and meta-data in the seed directory to (a) not set manual_cache_clean any longer, and (b) present a different instance ID.)
[19:24] <Odd_Bloke> Or am I missing a step?
[19:26] <Odd_Bloke> (I think I might be seeing a bug, but as I'm writing the documentation to follow, I can't be sure. :p)
[19:33] <smoser> well, assuming you otherwised cleaned up correctly, yes i think so.
[20:34] <Odd_Bloke> smoser: Yep, there's a problem: if you pass `manual_cache_clean: True` in, then it will persist forever (even if you remove that file, it will be replaced on next boot). We write the user-data from the first boot to /var/lib/cloud/instance/cloud-config.txt and on subsequent boots we read that file as part of our `Init.cfg` _before_ determining whether or not this is a new instance. This means that the
[20:34] <Odd_Bloke> configuration we use at runtime includes manual_cache_clean (even though the seed directory indicates this is a first boot, and its user-data does not include it), so we will always be in `trust` rather than `check` on that instance.
[20:34] <Odd_Bloke> (I'll file a bug with more details, this might be inscrutable if you haven't spent several hours staring at this code. :p)
[20:35] <smoser> well, thats righ though
[20:36] <smoser> its trusting cached data
[20:36] <smoser> that was the poitn
[20:37] <smoser> but i think if you removed that file (manual_cache_clean) then ds-identify will re-run.
[20:51] <Odd_Bloke> The problem is it's loading the cached data, then using that cached data to determine whether or not it should trust the cached data.
[20:52] <smoser> Odd_Bloke:its "manual cache clean"
[20:52] <smoser> *manual*
[20:52] <Odd_Bloke> OK, but you said that removing /var/lib/cloud/instance/manual-clean should be sufficient?
[20:53] <Odd_Bloke> And it isn't, because the presence of that is ignored if manual_cache_clean is set to True in the cached data.
[20:53] <smoser> So... "unfreeze", if manual_cache_clean was set is just:
[20:53] <smoser> rm -Rf /var/lib/cloud/instance /var/lib/cloud/instance/
[20:55] <smoser> i think you can probably get away with just the link.
[20:55] <Odd_Bloke> OK, right, so it isn't the case that "I should be able to unset this just by removing /var/lib/cloud/instance/manual-clean"? I'm just trying to make sure that I understand what's going on here.