/srv/irclogs.ubuntu.com/2020/08/19/#cloud-init.txt

rharperminimal: https://paste.ubuntu.com/p/xszQq4Vc48/00:02
minimalrharper: Thanks. Should the "import mock" be "from unittest import mock" or "from cloudinit.tests.helpers import mock"?00:23
rharperyes00:27
rharperI'm still working on getting tox to be happy00:27
rharperI've a few more fixes since that post00:27
rharperhttps://paste.ubuntu.com/p/tr6SRWKqjR/00:28
rharperthere, tox is happy with that00:28
rharperminimal: either works00:29
minimalyeah, went with  cloudinit.tests.helpers00:29
minimaltests pass fine now. Thanks! Don't really follow the changes you provided, need to read up on Python mock some time00:30
minimalGetting 2 flake2 errors about line > 79 which is 2 of the text.dedent lines for the expected content. Is there any way I can split/wrap those lines without it breaking the assert comparison?00:31
rharperminimal: so, I changed to mocking out your _write_repo_contents method (which called util.write_files)  for the no-write case, it was easier to check the call count on that00:33
rharperminimal: the second issue was the path to the template files, so I looked at test_handler_cc_ntp.py  and it sets up the helpers.Path object to the same reRooted path (self.new_root) this allowed the module to find the temporary template files it writes00:34
rharperand the final bit was just extra new line on the dedents00:34
rharperminimal: see my latest paste, I just left shifted the few tests that were too long00:35
minimalI should have spotted the missing "\"s on the dedents myself.....00:35
rharperit's not easy (IMO) to read the assertEqual output expectially for multi-line output00:35
rharperso I basically do a print(expected); print(); print(actual)00:35
rharperso I can see what the two things look like00:35
rharperthen it was obvious00:36
minimalwasn't sure if left-shift the extra long sections would cause flake8 to complain about lack of indent. I'll do that now.00:36
rharperI think since it's wrapped in a function call it's happy; plain tox came out clean after I did the left shift00:37
GI_Jackhi00:40
GI_Jackwhat resources exist for writing your own cloud-init modules00:40
minimalDecided to shorten that repositories comment line in both cc module and test_handler to solve to line length problem00:42
rharperGI_Jack: https://github.com/canonical/cloud-init/blob/master/cloudinit/config/cc_foo.py   is an example module;00:42
rharperminimal: =)00:42
GI_Jackmost excellent, thank you kindly00:42
GI_Jacknew interest is writing custom cloud images... :)00:43
minimalrharper: So just have to look at your ntp test_handler comments now.00:43
minimalthanks for all your helper. Not sure what timezone you're in but I'm sure its late there00:44
rharperhttps://cloudinit.readthedocs.io/en/latest/topics/hacking.html00:44
rharperminimal: US Central;    np;00:44
rharperfor the ntp one;  that'll take more work;  it really should be a pytest.mark.parametrized ... but that may be a bit steep refactor;00:45
rharperso I'd be happy with changes to not duplicate code paths with large bodies of if alpine else default ... and try to make the if else as *small* as possible, or use distro_name and/or client lookups into a mapping to adjust the separate results;00:46
rharperbbiab00:48
minimalrharper: over to you for review. Hopefully this can make it into 20.3 tomorrow.02:38
otuboblackboxsw_, thanks a lot :)07:56
otuboblackboxsw_, any chance to also take a look at https://github.com/canonical/cloud-init/pull/52107:57
b0urneI launched an windows-server-2016 instance in my cloud environment, When I tried to log on via vnc, the server rebooted. After checked the system log, the server was rebooted by cloud-init. Is this a normal behavior of cloud-init?08:31
crandonHi! Is there a way to completely disable IPv6 via cloud-init? While I found the question on some forum I haven't seen any replies nor such option in the official docs13:14
rick_hotubo:  he's out today. Did you want him to look at it when he gets back or I can ask someone else to peek at it later today13:33
otuborick_h, Hi! Yeah, doesn't matter actually, I'd be glad is anyone could review it :) thanks!13:34
otubo*if anyone could review it13:36
rharpercrandon: it's not a directy cloud-init option, but you could use a bootscript to  run a script which uses sysctl to disable ipv614:04
rharper*directly*14:05
crandonrharper: thx, I cam to the same conclusion.14:05
rharpercrandon: +114:06
crandonrharper: +1 = ?14:09
rharpercrandon: sorry just acknowledging your response;  +1 is sometimes used in code review to mark agreement14:10
falcojrI'm looking at https://github.com/canonical/cloud-init/pull/521 (thanks otubo) and it's working around our DHCP sandboxing, but I'm wondering if we could find a better directory to run dhclient from16:21
falcojrit's not uncommon to mount /var/tmp as noexec, so does it make sense to copy dhclient somewhere else before running it?16:22
minimalrharper: working on your feedback now17:22
rharperminimal: great17:32
AnhVoMSFT@rharper @blackboxsw_ we have seen a few deployments that failed with these kind of messages "UnicodeEncodeError: 'latin-1' codec can't encode character '\u1ecb' in position 373: Body ('ị') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8."18:05
AnhVoMSFThttps://paste.ubuntu.com/p/fqjmzZ38fJ/18:05
AnhVoMSFTI tracked that down to basically the hostname that the customer specified had some unicode character in it, which results in the instance_id returned from wireserver having the unicode character18:06
AnhVoMSFTis latin-1 the default encoding that python will use, if I were to encode the body of the report ready request to utf-8 would that help?18:07
rick_hAnhVoMSFT:  looking at the python code there a comment states it has to be laten-1 per RFC :/ so yea have to encode it first though then the question is what is going to read/decode it after the fact. What is it POST'ing to?18:18
rick_hAnhVoMSFT:  https://paste.ubuntu.com/p/Pqf5QxvvCp/18:18
AnhVoMSFTit's posting to the wireserver, a component in the Azure platform. I'm verifying whether it can handle UTF-8. It probably should, since it has been supporting unicode hostname on the Windows side18:25
rick_hlooks like the code around there has changed a bit. send_ready_signal() vs _report_ready() but yea I would expect just needing to encode the data in there somewhere to be wire-safe would be on par18:25
rick_hinteresting on the latin-1 requirement for the RFC in the http library.18:25
minimalrharper: cc_ntp.cc, the names.append you suggested (line 393) hitting pylint/flake errors.19:02
rharperok, I;ll try to clean up in a sec19:06
rharperminimal: what you've pushed to tip ?  or some additional delta?19:19
minimalrharper: what I pushed 1 hour ago19:22
rharperand a change I suggested19:22
rharperminimal: looks like just formatting; https://paste.ubuntu.com/p/YgqF4RvjJq/19:34
minimalrharper: I had a missing "]". Tox passing locally, just pushed again so buildjob should pass fully this time19:45
rharperyeah, and your suggestion works with fewer list joins, so +119:47
minimalrharper: Saw you re-wording comment. Happy with this: "By default, cloud-init will generate a new repositories file ``/etc/apk/repositories`` based on any valid configuration settings specified within a apk_repos section of cloud config."?21:49
rharperyes21:55
rharperminimal: yeah, that looks great21:55
minimalrharper: So what's left to get this merged?22:52
rharperminimal: nothing, I've approved;22:57
rharperI was waiting for CI to check out as well22:57
rharperI'll merge22:57
minimalrharper: Great stuff. Thanks for all your help22:57
rharperminimal: Thank you for the contribution and active refactoring!22:58
minimalrharper: No problem. Now I can prep to update the Alpine package tomorrow or Friday22:59
macjunkieprovisioning some AWS instances and referencing a cloud-init template in terraform the template (appears to get end up on the instance) but nothing ever gets executed. I found user-data.txt in /var/lib/cloud/instance on the instance (ubuntu 16) but no activity in /var/log/cloud-init.log etc..23:12
macjunkieanyone have any ideas?23:12
minimalmacjunkie: what about /var/lib/cloud/data/status.json?23:15
macjunkienope no mention of user-data23:15
minimalthat'll show if any error occurred during each of the cloud-init stages23:16
macjunkiei don't see any errors listed23:17
minimalUbuntu's systemd based, anything in the journal?23:18
macjunkiewoohoo found it23:19
macjunkie"util.py[WARNING]: Failed loading yaml blob. Invalid format at line 24 column 6: "while scanning a plain scalar"23:19
macjunkieit is processing it23:19
macjunkienow to fix my f'ing yaml23:20
macjunkiethx23:20

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