/srv/irclogs.ubuntu.com/2020/04/15/#cloud-init.txt

=== vrubiolo1 is now known as vrubiolo
otubopowersj, I'm gonna take a look. Thanks!07:08
andras-kovacshuh... I didn't know Azure can be this terrible... I made a VM template with cloud-init installed in it, but disabled. My intention was to start to use it with Azure's own telemetry-collector whatnot than change to cloud-init as soon as possible.10:28
andras-kovacsBut it says "[ProvisionError] cloud-init appears to be running, this is not expected, cannot continue."10:28
andras-kovacsI found a bug and the reason of it is/are probably the dhclient + NetworkManager scripts, but still...10:29
andras-kovacsI believed it can't be worse after the fixed-size IDE connected vhd files. But actually, it can.10:29
andras-kovacshttps://github.com/Azure/WALinuxAgent/issues/80610:31
andras-kovacsI was wondering... why do they need to re-invent the wheel?10:32
andras-kovacsEven more funnier this waagent doesn't even log it's error on error level to journal. :D11:37
StyXmanis it possble that if I deploy a user, setting its password  and marking it as expired, the password is set *after* it was marked as expired, so this password set overwrites the expiration date? BTW, there is no expriration date in /etc/shadow, only last change date and max password age12:54
StyXmanhere's my config: https://dpaste.org/4g8912:56
StyXmanin fact it's a bug: the image I'm using has a adduser who ignores --expirredate and there seems to be a function to go arund such bugs, but it doesn't seem to be used13:21
Odd_BlokeStyXman: Are you saying it's a bug in the image you're using, or you think it's a bug in cloud-init?13:53
StyXmanhttps://bugs.launchpad.net/cloud-init/+bug/187299513:59
ubot5Ubuntu bug 1872995 in cloud-init "expiredate is not working if also setting a password." [Undecided,New]13:59
otuboOdd_Bloke, powersj by the way, just found another bug on the swap file stuff. But won't make it to the release cut this time. Can't make upstream/backport in less than an hour.14:36
Odd_Blokeotubo: OK, hm, should we back out the original change so we can reland it with these fixes applied?14:36
otuboOdd_Bloke, powersj I'll post another PR soon, together with a unittest.14:36
otuboOdd_Bloke, that part is correct, the assignment should be after the try/except. The bug is at create_swapfile()14:37
otubocmd = ['fallocate', '-l', '%dM' % size, fname] ---> is treating size as %d when it is %s14:38
otuboerrmsg = "Failed to create swapfile '%s' of size %dMB via %s: %s" ---> here too14:38
otuboOdd_Bloke, I'll fix it and include the unittest by tomorrow. No need to drop anything right now.14:45
powersjotubo, thank you!14:45
mutantturkeyso i have only enabled a few specific modules from cloud init, but another thing cloud-init is doing is setting the 'hostname'16:12
mutantturkeyi don't actually want it to do so, is there a way to prevent it from overwriting my hostname i set in my custom image?16:12
blackboxswmutantturkey: the hostname gets set early in boot by cloud-init to fix a number of platforms that need hostname set before the initial dhcp request..... I'll get you where that's done.16:13
blackboxswand we'll see if it can be disabled16:13
mutantturkeyis it    199 ^[[0;32m    digitalocean: /usr/lib/python3/dist-packages/cloudinit/config/cc_set_hostname.py^[[0m16:13
mutantturkeysorry the output got munged16:13
mutantturkeyi did find a "echo "preserve_hostname: true" > /etc/cloud/cloud.cfg.d/99_hostname.cfg" but i wasn't sure if that was accurate16:14
blackboxswmutantturkey: it's in cloudinit/cmd/main.py16:15
blackboxswmutantturkey: https://github.com/canonical/cloud-init/blob/master/cloudinit/cmd/main.py#L698-L71316:15
blackboxswso it's set only if user-data or meta-data on the cloud provides that value16:16
blackboxswbut yes, ultimately calls cc_set_hostname16:16
andras-kovacscould you point me to the right direction to find a cloud.cfg which works in Azure? I mean which can set the hostname, etc. from the meta data.16:17
blackboxswmutantturkey: you can check if DO provides that hostname in metadata with `cloud-init query --all`16:19
* andras-kovacs sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/SZJZxEKrgcFXnlWGZLCUSoed >16:20
andras-kovacsbut cloud-init query -a gives [] nulland ""16:20
mutantturkeyblackboxsw: cloud-int query --all: error argument subcommand: invalid choice 'query'16:22
mutantturkeycloud-init -v: 15:58 <@blackboxsw> but yes, ultimately calls cc_set_hostname16:23
mutantturkeysorry, /usr/bin/cloud-init 18.316:23
andras-kovacsbut I can read the meta data with curl... hmmm..16:23
andras-kovacsmutantturkey: cloud-init query -a16:23
andras-kovacsmutantturkey: I like your name. Do you watch SouthPark?16:24
Odd_Blokeandras-kovacs: Where is your current cloud.cfg coming from?16:24
mutantturkeyandras-kovacs: no, i mean i have seen it, but i dont know the reference16:24
Odd_Blokeandras-kovacs: mutantturkey: 18.3 predates `cloud-init query` being available, I believe.16:24
mutantturkeyOdd_Bloke: seems so16:24
mutantturkeyi am fairly certain that the hostname is set by cloud init, as it sets it to the first part name of the DO box. (x.y.z: it is set to x)16:25
mutantturkeyand the logs confirm16:25
mutantturkeyRunning command ['hostname', xzy]16:26
andras-kovacsOdd_Bloke: from the package, the default. So I need to play around with it. It worked so good with openstack for the first try. But Azure is really different. Do you have a link or sg. for a working sample config? I saw the one in the doc but I got confused because of the __builtin__ and dhclient_lease_file part.16:26
mutantturkeyyeah; 2020-04-14 17:59:09,190 - util.py[DEBUG]: Read 51 bytes from /var/lib/cloud/data/set-hostname16:27
andras-kovacsI don't know yet how to define the the lease file, because I use NetworkManager and it looks like /var/lib/NetworkManager/dhclient-5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03-eth0.lease16:27
Odd_Blokeandras-kovacs: "the package" on what distro?  It works out of the box on Ubuntu, and I haven't heard of any other substantial issues.16:33
andras-kovacsRedHat 7.8. I could proceed further, but now I see: DataSourceAzure.py[WARNING]: Could not crawl Azure metadata: No Azure metadata found.16:56
VittoHello, I am a novice programmer and I am trying to use the cloud init functionality via Scaleway API but cannot seem to get it to work. I have a working cloud init shellscript that does its job when launched via web dashboard. Instead, when I try to submit it via API it seems that the cloud init boot does detect the script. Is anyone able to help17:20
Vittome?17:20
rharperhi Vitto  one possible issue is how the API attaches the user-data to their instance ... some platforms require the user-data content (cloud-config yaml) to be base64 encoded ... is there any API documentation on scaleway that migth help ?17:23
johnsonshiHi guys, I have a question regarding trying to specify my own systemd unit to start in the middle of cloud-init.service and cloud-config.service. The question is here at: https://paste.ubuntu.com/p/tR6vMm6SGd/17:30
Vittorharper this is the user data section of the scaleway API https://developers.scaleway.com/en/products/instance/api/#user-data-35f60e, it does not mention anything regarding base64 encoding, I'll ask them directly in the meanwhile.17:44
mutantturkeyso documentation says hostname can be specified via hostname key, in my cloud-init ustom config would that be17:55
mutantturkeyhostname: myname17:55
mutantturkeythat worked, and since i know the expected hostname, my problem is solved. dope18:10
Odd_Blokeblackboxsw: rharper: https://github.com/canonical/cloud-init/pull/316 should fix swap file creation in master; I'd appreciate a speedy review so we can discuss cherry-picking it to fix focal before Final Freeze (tomorrow :p).20:14
Odd_Blokeotubo: Apologies to perhaps duplicate your work; today is the last day to get fixes into the next Ubuntu release on day one, so this is urgent for us. :)20:14
blackboxswOdd_Bloke: +1 grabbing20:23
blackboxswOdd_Bloke: nit comment  https://github.com/canonical/cloud-init/pull/316#pullrequestreview-39411523320:35
blackboxswOdd_Bloke: I see in the failure path case on cc_mounts:create_swapfile that if create_swap fails, it deletes fname, but then create_swapfile proceeds to     util.chmod(fname, 0o600)20:47
blackboxswwhich should no longer exist20:47
blackboxswis it worth create_swap raising in the util.ProcessExecutionError failure path?20:48
blackboxswjust after the warning and del_file20:48
Odd_Blokeblackboxsw: I'm just trying to apply the minimal fix that gets previously-working configurations to continue working.20:48
Odd_Bloke(I'm not saying there isn't work to be done to improve the failure mode, but that's not RC.)20:49
blackboxswgood pt. so for that, we can avoid the failure path test case (because it exposes this error).  I was trying to write up a failure_path test to get coverage on the errmsg  template as well20:49
blackboxswso we are good with happy_path test only20:50
johnsonshiHi guys, does including both "After=cloud-config.target" and "Before=cloud-config.service"20:50
johnsonshi in a custom systemd unit ensure that the custom systemd unit is started after cloud-init.service finishes but before cloud-config.service starts?20:50
Odd_Blokeblackboxsw: Responded to your comment; will also work to improve the tests here.20:50
Odd_Bloke(But I don't think we should block landing this on improved tests; it's completely broken right now, I can't make it worse with this change. :p)20:51
blackboxswjohnsonshi:  maybe After=network-online.target cloud-config.target and Before cloud-config.service20:51
blackboxswOdd_Bloke: +1 on your PR with that in mind that we will have a followup20:51
Odd_Blokeblackboxsw: Ack, thanks.  (Can you mark that in GH so I can land it?)20:52
blackboxswOdd_Bloke: merged20:53
johnsonshiblackboxsw: Thanks for the that tip! Hopefully this time the custom systemd unit should always run in the correct order. Thanks!20:55
rharperjohnsonshi: I think your initial config is sufficient;   cloud-config.target already has After on cloud-init.service; and cloud-config.service runs after cloud-config.target;21:02
blackboxswOdd_Bloke: rharper https://github.com/canonical/cloud-init/pull/31821:11
blackboxswcherry-pick release to review21:12
Odd_BlokeI'm not 100% sure how to replicate that locally currently, but that LGTM.21:12
blackboxswOdd_Bloke: sorry added cmdline steps21:14
blackboxswto the PR description21:14
Odd_Blokeblackboxsw: +121:28
Odd_Blokeblackboxsw: https://github.com/canonical/cloud-init/pull/319 is the best I can do for additional tests; the sad path is actually broken more deeply than just the variable substitution (as you pointed out), so I'll leave it for now.21:33
blackboxswthanks Odd_Bloke will look it over before tomorrow21:33
blackboxswcommunity notice: [ubuntu/focal-proposed] cloud-init 20.1-10-g71af48df-0ubuntu4 (Waiting for approval)21:39
blackboxswwe are hoping to release that swap file creation into Ubuntu Focal before LTS  release is final21:39
=== vrubiolo1 is now known as vrubiolo

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