/srv/irclogs.ubuntu.com/2017/07/12/#cloud-init.txt

=== Wulf4 is now known as Wulf
nilujethanks smoser :) let's review your review08:22
* Putti got added to the contributor agreement group! :)10:34
nilujesmoser: I still don't understand anything to the launchpad interface, but all your comments have been addressed :)10:37
nilujeI cant rebase my commits into one if you want me to10:38
Puttioh, the tox tests take like 5-10 min to run :/11:12
Puttithey are contacting the outside world?11:12
=== shardy is now known as shardy_lunch
Puttiwhee, first merge request done. Was kinda tedious – I have to look up if I can integrate it somehow with my command-line flow.11:39
nilujePutti: if you are doing some hacking/debugging11:51
nilujerun tox -e <env>11:51
nilujelike tox -e py2711:51
nilujeor to run a single test tox -e py27 -- cloudinit/unittest/xxx.py11:51
nilujeor tox -e py27 -- cloudinit/unittest/xxx.py:Classname or Classname:test_name11:52
Puttiok11:52
nilujeor call nose directly: .tox/py27/bin/python -m nose --tests cloudinit/unittest/xxx/.py -x -s11:52
nilujetox has always been super slow for me for everything11:53
Puttiniluje, but maybe huge part of the slowness is just that it contacts all the web servers?11:54
Puttifor me the test tries to contact google but fails11:56
Puttimaybe the slowness is because of this: "FAIL: test_get_data_returns_false_if_not_on_gce (tests.unittests.test_datasource.test_gce.TestDataSourceGCE)"11:57
PuttiI will link the full log, a minute...11:58
Puttihttp://paste.debian.net/plain/97611811:58
PuttiThe ISP I am currently connected redirects to their own web page if the resource is not found, maybe the unit test gets confused by this?12:03
nilujelol12:08
nilujeanyway IMO a unittest should never hit a network resource12:08
* Putti agrees with that12:09
nilujebut I'm pretty sure they don't12:09
PuttiI guess a temporary fix is for me to use different dns.12:09
nilujewhich env is it? py27?12:09
Putticorrect12:09
Puttipy2712:09
nilujesec12:10
=== shardy_lunch is now known as shardy
nilujeyeah nevermind12:11
nilujebut I guess if you find the place where a network resource is hit, cloud init maintainers will be interested in a fix12:13
Puttinot too hard to find: cloud-init/tests/unittests/test_datasource/test_gce.py :)12:15
PuttiI might look into how to fix it12:15
=== mpontillo_ is now known as mpontillo
powersjPutti: if you find a test is escaping out to the network please file a bug. However, I am fairly certain nothing attempts to get out.14:51
powersjThose calls should be mocked, as those metadata services should not available outside the cloud providers network14:51
Puttiit seems like the GCE test mocks the request but somehow it lets the dns request pass through.14:58
blackboxswPutti: I can peek at that today too if you don't end up tackling it15:01
Puttiblackboxsw, thanks, I'm pretty new to cloud-init and also I have very minimal experience with unit tests in python so if you just have time it would be nice. Though, I'm so curious about this problem, so we will see if I figure out the fix (in case one is needed) for this before you.15:04
blackboxswPutti: +1 and welcome to the club, I'm relatively new to cloud-init too.  Putti appreciate your efforts fire off any questions you might have and we can field them. to speed unit test debug cycles you can put a pdb.set_strace() over in the unit test you care about and tox -e py3 -- --tests tests.unittests.test_datasource.test_gce.TestOpenStackDataSource -s15:24
blackboxswPutti: +1 and welcome to the club, I'm relatively new to cloud-init too.  Putti appreciate your efforts fire off any questions you might have and we can field them. to speed unit test debug cycles you can put a pdb.set_strace() over in the unit test you care about and tox -e py3 -- --tests tests.unittests.test_datasource.test_gce.TestDataSourceGCE -s15:24
blackboxswput you probably already know that15:25
PuttiI actually didn't know that, thanks :)15:25
blackboxsw*but...   I need to go find my typo-free keyboad15:25
blackboxsw:)15:25
Puttiblackboxsw, I have some ideas for a possible fix. 1. We could mock cloudinit/url_helper.py's readurl() in the test_gce.py so that "allow_redirects=True" will be changed to False. Or the metadata.google.internal domain could be changed to 169.254.169.254 (this seems to be some sort of special ip) like some other datasource tests already do.15:32
blackboxswPutti: checking that unit test now to see exactly what you mean.15:37
PuttiHere is some information about the magic ip address: https://askleo.com/why_cant_i_connect_with_a_169254xx_ip_address/15:40
blackboxswright that address, 169.254.169.254, is link local, which means those packets (if they hit your network) shouldn't be forwarded beyond your router. so expectation is that link-local ips will timeout on your local  network. But in the interest of expedience in unit tests, instead of long timeouts we should cut those tests off to avoid lengthy timeout waits. (or we should ensure that our timeout length is as15:46
blackboxswsmall as possible.15:46
blackboxsws/cut those tests off/mock those external queries to 169.254.*.* so that the expected response is immediate/15:47
Puttithe question is: how do we do that?15:48
Puttiooh, I see, mocking them15:48
Puttimhm, but aren't they already mocked? It is just dns that is slowing down, and now there is no dns15:48
PuttiI mean if we use ip address15:49
PuttiHmm, I wonder if this is something that should be fixed in one of those http request mocking python modules we use. But as a temporary fix for us would be removing host names and use ip addresses instead.15:54
blackboxswPutti yeah strange about your pastebin. Since that unit test is mocking platform_reports_gce() to return False, I'm not certain why your env is attempting to access metadata.google.internal hostname15:56
blackboxswhmm Putti that mock doesn't really work it seems. If I put a pdb.set_trace() in  cloudinit/sources/DataSourceGCE.py get_data():16:02
Puttiyes it doesn't ... I got a new idea why, a minute!16:02
blackboxswhttps://www.irccloud.com/pastebin/1xAbn5DV/16:02
blackboxswwe shouldn't get there if we .tox/py3/bin/python3 -m nose --tests tests/unittests/test_datasource/test_gce.py:TestDataSourceGCE.test_get_data_returns_false_if_not_on_gce -x -s16:02
blackboxswbut we do16:02
blackboxswyeah that mock setup in that test is broken16:03
PuttiI'm trying now adding "_set_mock_metadata" to the test16:04
Puttierm "_set_mock_metadata()"16:04
Puttimhm, I guess there is no point in adding that... I guess I need to focus on reading the code for a minute :P16:06
blackboxswPutti: can you test this patch? http://paste.ubuntu.com/25076047/16:09
Puttiyes, a moment16:09
blackboxswyeah I don't like mocks, they don't always behave as you'd expect them. In the case of this unit test the setUp() declared the mocked return_value for cloudinit.sources.DataSourceGCE.platform_reports_gce as True. Then the subsequent unit test tried to override that return value incorrectly to False.16:12
blackboxswusing the patch decorator on the specific unit test we can ensure that the unit test has properly overridden that return_value to False instead of setUp's "True".16:12
blackboxswthe problem with our tests was that our broken mock as actually still returning True for platform_reports_gce() so get_data() was attempting to perform all those queries against metadata.google.internal which it never should have gotten to16:14
Puttipaste.ubuntu.com requires you to login (which doesn't work without javascript) if you want to see the plaintext without javascript. Another moment.16:15
blackboxswoops16:16
Puttigit doesn't seem to like the patch16:18
* Putti does the changes manually16:18
Puttiblackboxsw, the patch works, though no idea what it does :D16:22
Puttiaha, ok, I read your explanation now, and it makes sense16:23
Puttithanks!16:23
blackboxswPutti: awesome. So that @mock.patch is me telling the specific unit test to mock the  DataSourceGCE.platform_reports_gce  within our unit test only. Then I set return_value = False there to the mocked method. This ensures the unit tests overrides the mock which was established in setUp()16:24
blackboxswyeah no prob16:24
blackboxswthanks for finding the bug and working through it w/ me16:24
Putti:)16:24
blackboxswyou can file a merge proposal if you want with that patch and I'll approve and land it if you'd like to go through the process. Or I can, either way16:24
Puttiblackboxsw, you should do it, you're the author16:25
blackboxswPutti could  you please file a bug against and link your initial problem paste then :) gotta get you some karma for finding this issue and bringing it to us. (and we need bugs associated w/ any cloud-init fix)  https://login.launchpad.net/08ubw7bY4m0DWmsi/+decide16:26
Puttisure, bug report coming soon16:27
blackboxswhttps://bugs.launchpad.net/cloud-init/+filebug rather16:27
blackboxswthanks again16:27
powersjblackboxsw: can you send me a pastebin of the mount image callback stuff16:30
Puttiblackboxsw, https://bugs.launchpad.net/cloud-init/+bug/170393516:30
ubot5Ubuntu bug 1703935 in cloud-init "GCE unit test tries to connect to the network" [Undecided,New]16:30
blackboxswawesome thank you again16:31
Puttinot very nice view: https://launchpadlibrarian.net/328486103/error .. Maybe I should have added .txt extension.16:32
naccPutti: is that for the bug attachment?16:33
naccPutti: edit it and mark it as text/plain instead?16:33
Puttinacc, yes16:33
Puttidoign that :)16:33
naccPutti: it's currently text/html which is probably wrong :)16:33
* nacc has an open self-bug for lp-attach to fix that in that particular tool :)16:33
Puttido you know if I can file somewhere a bug against paste.ubuntu.com ?16:51
Puttinvm, https://launchpad.net/canonical-pastebin ... but it seems that it is not under a free license :(16:54
blackboxswsmoser: still working on ipv6 support. scaly implementation looks easy on an already configured interface with a valid broadcast over UDP was easy with scaly http://paste.ubuntu.com/25064349/.17:20
smoserblackboxsw, i think that the dhclient paht is probably sane as a first pass.17:20
smoserfreebsd is affected too though and need to think about that.17:20
blackboxswbut, this requires that the interface is already up and configured. using dhclient  and cleaning up after seems the lowest hanging fruit as unicast packet sending on a raw socket requires a bit more reading for me (couple days probably()17:21
blackboxswsmoser: +1 and centos dhclient supports a slightly different set of cmdline options that we'd have to account for (minimally "-I" is interpreted differently )17:22
dpb1blackboxsw, smoser: first pass making dhclient-capable distros work seems sane.  This isn't working anywhere that I know of?17:24
dpb1(on aws)17:24
smoserblackboxsw, powersj i guess we could/should run c-i 'tox' at least with networking taken down.18:25
Putti+118:28
jhodappI'm curious if there's any special way of loading certain kernel modules via cloud-init or if I might simply use modprobe to do so in the free form command run section of the yaml config file?20:30
larsksjhodapp: that should work (using runcmds, or just submitting a /bin/sh script in place of or in addition to the YAML file)20:31
jhodapplarsks, ok, so there's really not any special provision for doing so20:32
larsksRight.20:32
jhodappok20:32
smoserblackboxsw, https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/327325 you can push that if you want.22:15
blackboxswthx smoser, I have a working dhclient client run using your WIP branch on aws + a new dhcp_request_clean() function in cloudinit/net/_init_.py.22:16
smosernice22:17
blackboxswjust polishing off a simple dhclient-script that could-init would deliver to ensure no other side-effects come from run-hookos22:17
blackboxswjust polishing off a simple dhclient-script that could-init would deliver to ensure no other side-effects come from run-hooks22:17
blackboxsws/polish/pollish?22:17
smoserblackboxsw, do you have something pushe d?22:32
blackboxswsmoser will pull it down from my aws instance and push in a min22:32
smoseryeah22:33
blackboxswsmoser: a junker WIP for the moment https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+ref/aws-dhclient22:37
blackboxswI hacked up  the assign_ipv4_link_local context manager to call the dhcp_request_clean()22:38

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