/srv/irclogs.ubuntu.com/2018/04/13/#cloud-init.txt

blackboxswthx smoser I'm reworking ifconfig-drop branch to incorporate more review comments, it'll be tomorrow before it's ready01:36
blackboxswjust found a bug in the dropping ifconfig/route branch on devices which don't have addresses (like deactivated wirelesss interfaces).16:42
blackboxswtweaking the logic and also attempting a regex approach instead of this separate for loop nonsense to see if it's faster16:42
blackboxsws/separate/decoupled/16:43
smoserblackboxsw: help ?18:57
smoserhttp://paste.ubuntu.com/p/sWZg7wbPNH/18:57
blackboxswchecking. /me is neck deep in regex atm18:58
dpb1blackboxsw: don't die19:00
blackboxswso python only imports a module once right, once the mock is active it would apply to the global wouldn't it until the mock is released.19:01
naccsmoser: are cloudint.util and cloudint.ssh_util.util the same thing?19:01
* blackboxsw checks to be sure19:01
blackboxswyeah they are the same19:01
nacci think this a case where yhou need to mock the local util.write_file19:01
naccnot the one in the class19:01
naccbecause it's already been imported at this point19:01
nacchttps://docs.python.org/3/library/unittest.mock.html#id5 the bit about mocking where something is used19:02
naccand importing puts things in the local namespace, not the source namespace (iirc)19:02
naccit's different if you do a from ... import too19:02
smoserblackboxsw: yeah, they're the same thing. and yeah nacc is right i'm sure, bu t i just should have somehow known this before. i'm sure we do stuff like this otherplaces in tests.19:06
smoserbut oh well19:06
naccsmoser: i ran into this while writing some of our tests for git-ubuntu19:06
naccsmoser: if you had just run 'import cloudinit', i believe your code would dtrt19:07
naccsmoser: but since you import a specific module from cloudinit, it 'imports' it into the current modules' namespace19:07
naccso there's now a testme.util which is what you actually want to mock, i think19:08
nacc(or so, there are some examples i've found in the past for what you are supposed to use for hte module/class name)19:08
nacci can keep the logic in my head for about 1 minute and then it slips away again :)19:08
naccsmoser: the frustrating part is, it also depends on how the tests run -- so sometimes things work when they really probably shouldn't (or you end up getting one test affecting all other tests in the same class/test file)19:09
sebaheyja23:05
sebaI'm currently playing around with the cloud init user_data config23:09
sebaI'm wondering... if the image I want to configure with cloud-init has a lot of stuff configured in its /etc/cloud/cloud.cfg (a debian in this case) how can I override these defaults?23:09
sebathe debian default cloud.cfg adds a default "debian" user. I don't want that, but it seems to be specified there and it gets added even if i specify my own users in my user_data23:10

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