/srv/irclogs.ubuntu.com/2017/04/27/#cloud-init.txt

=== jdm_ is now known as jdm
=== sambetts|afk is now known as sambetts
=== shardy is now known as shardy_lunch
=== shardy_lunch is now known as shardy
nilujehello, I'm trying to write a connector for Scaleway (https://www.scaleway.com/)12:30
nilujeBy running `cloud-init --file ~/cloudinit.yaml init` with "datasource_list: [Scaleway]" in ~/cloudinit.yaml, I have an exception I don't understand:12:30
nilujehttps://pastebin.com/98PwbVBR12:30
nilujeany chance someone can help me understand what is going on?12:31
smoserrharper,  you do not need python-argparse on centos712:52
smoserpython-argparse is really just a 2.6 thing. as its builtin to 2.7+12:52
smoser$ python3 -c 'import argparse; print(argparse)'12:52
smoser<module 'argparse' from '/usr/lib/python3.5/argparse.py'>12:52
smoser$ python2 -c 'import argparse; print(argparse)'12:53
smoser<module 'argparse' from '/usr/lib/python2.7/argparse.pyc'>12:53
smoseri'm not saying that the rpm isn't broken, but the answer is to probably not depend on it. not sure how really to do that in rpm an dsuch.12:53
=== rangerpbzzzz is now known as rangerpb
smoserniluje, hm.. not sure what woudl have ahppened there.14:16
smoseri suspect you must have a network_config thing that is returning invalid data14:17
rharpersmoser: I know we don't need it; but somehow it's in the rquires.txt file which python checks when loading14:17
smoserrharper, that gets used for the rpm i guess ?14:18
rharpersmoser: harlowja: running with this which works but not sure that's the right thing to do: http://paste.ubuntu.com/24466885/14:18
rharpersmoser: it's used by python setuptools or whatever, entry point thingy that reads egginfo14:19
nilujeabout my issue, here is the code of the connector: https://github.com/brmzkw/cloud-init-scaleway/commit/110bb3e02608cb29ec67fe180cac4a48e3bc548b  and my configuration + the errors I have: https://pastebin.com/qjBW8TGg14:19
rharperhttps://github.com/certbot/certbot/commit/8f101034960ffc1e47879314585898efda234e6014:19
rharperthis is sorta the issue as well;14:20
smoserniluje, can you get a cloud-init.log ?14:20
rharperIIUC, special case python2.6 to add that dep (in packaging) and from > 2.6 it's standard library, so shouldn't be in requirements (or at least not show up in egginfo) ?14:20
nilujesmoser: where is it stored?14:20
niluje /var/lib/cloud?14:20
smoseri suspect that you've gone down the path of reading command line parameters that cloud-init has... and that it went wrong.14:20
smoser/var/log/cloud-init.log14:20
smoserif it sees ip= on the command line, it takes *that* as the fallback networking, and then tries to read files that ubuntu's initramfs tools writes14:21
rharperso, on ubuntu, we package the requires.txt file, but it's empty14:21
nilujesmoser: cloud-init.log is empty14:22
smoserubuntu ?14:22
nilujeyes, xenial14:24
nilujeI git-clone'd the cloud-init repository and pip install -e .14:24
smoserhm..14:26
smoseri suspect that there is no /etc/cloud/cloud.cfg.d/loggin* ?14:27
smoser(i'd install from package and just make your updates that way)14:27
smoseror build a package from trunk and install it.14:27
smoser ./tools/bddeb14:27
smoserinstalling with pip is not something i've really ever tested.14:27
nilujeewww14:27
nilujeok14:27
nilujelet me try installing the package with apt then14:27
smoseryou'll still fail for sure14:28
smoserbut hopefully get a log :)14:28
nilujehow to you work on cloud-init then?14:32
nilujeapt-get install cloud-init, then git clone, pip install -e ., $> cloud-init init?14:32
nilujeI just apt-get install'ed the package, updated /etc/cloud/cloud.cfg to add "datasource_list: [Scaleway]" and call "cloud-init init" but cloud-init is trying to contact the EC2 APIs :/14:35
smoserniluje, generally i install the package. taht is what a distro is going to do anyway.14:40
smoserhm..14:40
nilujeand then?14:40
nilujehow do you edit the code?14:41
smoserwhen hacking i just change files in /usr/share///14:41
smoserand re-try and such14:41
smoserthen i take those chagnes and re-build / dpkg -i14:41
smoseryeah, i know its not the best. but dpkg -i isn't actually *all* that different from pip install.14:42
nilujehm14:42
nilujehow do you build the package?14:42
smoser./tools/bddeb14:42
smosersoryr14:43
smoser./packages/bddeb14:43
smoserhttps://bugzilla.redhat.com/show_bug.cgi?id=119445115:37
ubot5bugzilla.redhat.com bug 1194451 in cloud-init "[PATCH] Add dnf support to cloud-init" [Low,Closed: rawhide]15:37
smoserniluje, so... what was happenging for you was that16:28
smosera.) you boot with 'ip=' on the kernel cmdline (which makes good sense)16:28
smoserb.) cloud-init recognizes that as saying taht the initramfs configured networking and that it should read its networkign from that.16:28
smoserrather than generating "fallback" config, which is "dhcp on the first nic you think looks good"16:29
smoserbecause obviously bouncing the nic would be bad on a network moutned root device16:29
smoserthe problem is that your initramfs does not generate /run/net-<NAME>.cfg files that cloud-init expected to read some information from.16:30
smoserand thus it ends up generating a completely empty config that fails16:30
nilujeok16:30
nilujebut should our initramfs generate the /run/net-<NAME>.cfg file?16:30
smoserwell, mkinitramfs-tools does (ubuntu/debian)16:31
smoserbut there is no official format of that, its just kidn of happensatnce16:31
smoserthe other option would be to have cloud-init realize there are no net-* and do some other sort of searching to figure out what the network config is.16:31
nilujeok so what you did (I haven't checked yet) is remove the read from /run/net-xxx.cfg and it works, right?16:32
smoserno. those files do *not* exist for you16:32
smoserand cloud-init is expecting them16:32
nilujeI know16:32
nilujeI understand that16:32
smoseroh. right. yeah.16:32
smoserhttp://paste.ubuntu.com/24467477/16:32
smoseri just made it not pay any attention to the kernel cmdline16:32
smoserbut that probably fails eslwehere16:33
nilujeok16:33
smoseras cloud-int will write a /etc/network/interfaces that says it should dhcp on eth016:33
nilujeok16:33
smoserwhich best case fails on 'ifup' (because that is already up)16:33
smoserand worst case brings down the link that you have to the root device16:33
nilujeso what I need to do is 1/ first, create manually the file un /run, 2/ make cloud-init work 3/ in //, update our initrd to create the files in /run/net-xxx.cfg16:34
nilujeand everything should work16:34
nilujecorrect?16:34
smoserif your initramfs writes those files, it should work yeah.16:34
nilujeok16:34
smosertheres no standard way to do this.16:34
nilujeI don't even know what is the format of those files :p will check16:35
nilujethanks a lot for your help smoser16:36
smoserniluje, see cloudinit/net/__init__.py _klibc_to_config_entry16:43
smoserblackboxsw, http://paste.ubuntu.com/24467573/16:45
smoserthats what i'll just upload with16:45
blackboxswsmoser, ok so that's our bug list for the SRU?16:46
smoseryeah16:47
smoserhm.. and maybe i'd rip out the  yum one16:47
smoser(not reference it)16:47
smoseryeah, i think i iwill16:48
nilujethere's no reference to _klibc_to_config_entry in cloudinit/net/__init__.py16:53
nilujek in cloudinit/net/cmdline.py16:53
smosersorry16:55
smoseryeah16:55
smoserniluje, and then in the tests therea re examples16:55
nilujesmoser: this is the function reading /run/net-xx.cfg and convert it to a cloud-init config object, right?16:58
nilujesorry for the stupid questions I'm not familiar with cloud-init so I struggle a bit to understand what needs to be done16:59
nilujeok yes, that's it17:00
nilujeI will look into it tomorrow17:00
nilujethanks a lot again for your help smoser, I'll post a message here when the connector will be working17:00
smoser _klibc_to_config_entry is what converts17:02
smoserand the test functions show examples of the net-*17:02
blackboxswsmoser, so SRU info, last time you created https://public.etherpad-mozilla.org/p/cloud-init-sru-info   will we do the same type of thing for this sru?17:08
smoserblackboxsw, i think its useful, yeah.17:09
rharperhttps://docs.fedoraproject.org/en-US/Fedora/8/html/SELinux_FAQ/index.html#id503239 ; that's troublesome;  ifconfig output is thrown away due to selinux, you can get it by reading it from the pipe (instead of the terminal) and writing to file (ifconfig -a | cat >out)17:09
smoserblackboxsw, https://public.etherpad-mozilla.org/p/cloud-init-sru-info17:09
blackboxsw... clunky  rharper17:11
rharperyeah, I'm more worried about cloudinit.util.subp17:11
rharpernot sure that's working as expected17:11
* rharper is testing that now17:11
smoserrharper, see, i told you enforcing=off17:13
smoser:)17:13
rharperlol17:13
rharpernot the *right* answer17:13
rharperbut yes17:13
rharperyou were right17:13
smoserif everyone in the world says that 2+2 = 5, then that is 'right' for some definition of right ;)17:14
smoseri wonder17:14
smoserrharper, if we close the standard input17:15
rharperplaying with subp now17:15
smoserhm..17:15
rharperI think it's already closed though17:15
smoserwell, standard output is probably indirectly attached to a temrinal17:15
smoseri don tknow17:16
rharperserial console17:16
smoserwell, /dev/console17:16
rharperbut yeah; this gets into the magic of tty17:16
rharperand other things17:16
smoserwe should be ablet to just close enough file handles and such though so that , before that subp (or all with 'capture') no open file handles are a termianl17:17
smoserid' think that would do it17:17
rharperso, subp defauts to data=None (stdin is fd of /dev/null) and capture=True, sets up a pipe17:18
rharperI just need to confirm we get output; there's a separate netstat -rn returning 1; I don't yet know why17:18
rharperhttps://bugs.launchpad.net/ubuntu/+source/net-tools/+bug/125156317:19
ubot5Ubuntu bug 1251563 in net-tools (Ubuntu) "netstat command returns nozero even if successively executing" [High,Fix released]17:19
rharperwell, tha;s just strange17:19
rharperbbiab17:19
powersjhttps://paste.ubuntu.com/24468378/19:19
powersj^ unit test failures on centos 6 + 719:19
powersjI'll go play with https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/323265 shortly19:19
smoserpowersj, great.19:24
=== sambetts is now known as sambetts|afk
rharperhttps://bugzilla.redhat.com/show_bug.cgi?id=140652020:22
ubot5bugzilla.redhat.com bug 1406520 in libselinux "calling libselinux python restorecon fails on /var/lib/nfs/rpc_pipefs" [High,Verified]20:22
rharperit appears that's hitting in centos7 image20:22
* rharper is confirming 20:22
rharperbummer, I don't see 2.5-7 released yet20:26
=== rangerpb is now known as rangerpbzzzz
powersjhttps://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/32335120:37
powersjAll I got rid of was the use of the array for the patches and got rid of one that was useless20:37
powersjoh and cleaned up pylint errors20:38
powersjrharper: if you could help me better understand what else you would want changed to smoser original proposal that would be good. You mentioned moving the asserts20:38
rharperpowersj: yeah, lemme get a pointer20:38
rharperpowersj: so, each of the patch_XXX should be @mock.patch.object(util, 'write_file') on the helper function; then pass that in as a mock_xxx to the _apt_source_list method;  the decorator does the start/stop automatically for you;  then in them ethod, the mocks that have return values or side-effects, you just need to apply those based on the input,20:42
powersjoh you wanted decorators20:43
rharperpowersj: I think all of them are constant values, except the mock_shouldcfg, in which case you just mockshouldcfg.return_value = (cfg_on_empty, "this is for test")  in the method20:43
rharperfirst20:43
rharperand then, I really want the caller who knows if they sent "debian", "ubuntu" to run the asserts;20:44
powersjso end that function after running cc_apt_configure.handle20:45
rharperso, test_apt_v3_source_list_debian knows what config it sent and which distro is being used20:45
rharperknowing those things, it can test that it expects for should_config to return true20:45
rharperthe other variable is "is_system_snappy"  which I think I'd like to assume its no , and then have a single test_apt_v3_source_list_snappy; where we return True on that and then can confirm that apt_configure wasn't run20:46
rharperthat'll break up much of the if block of asserts based on the config_on_empty list20:47
rharperthe test_ method calling the helper should construct the path and test it explicitly;  if there is something that we know *always* gets called then I think the helper could assert it; but I'd rather the caller do the asserts since it's setting up the test scenario20:48
rharperif that makes sense20:48
powersjrharper: ok I think I follow all that. I'll give it a shot and come back.20:48
powersjit does20:48
rharpercool20:49
rharperwould you like me to paste this log into the MR  comment ?20:49
powersjsure :)20:49
rharperk20:49
rharpersmoser: http://paste.ubuntu.com/24468995/  ; looks like we get to have "fun" with centos7 network/cloud-init.local ordering  in systemd21:02
rharperor I need to figure out how in brpm to tell it we require systemd;  noticed that difference in the 0.7.5 vs. a local build21:04
* rharper learns of -b systemd in brpm 21:10
rharpernow for more fun21:10
rharperha, systemd units worked!21:21

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