/srv/irclogs.ubuntu.com/2018/05/10/#cloud-init.txt

mgerdtsthanks blackboxsw.  I'll try to get through all of your suggestions today or tomorrow.12:24
robjosmoser: Q about ds-identify/cloud-init-generator14:42
smoserok.14:43
robjoWe've run into a case where ds-identify fails because blkid cannot be found14:43
smoseras in not present ? or not in path14:43
robjoblkid lives in /sbin, but it also lives there in Ubuntu14:43
smosercloud-init assumes that the system is set up to have a sane path14:44
robjonow if I modify ds-identify to be /sbin/blkid then the error goes away14:44
smoserisnt it just more reasonable to have PATH set up to have utilities in it than to have every tool hard code where it thinks the right place for that is ?14:44
robjobut the generator run in the context, i.e. the environment of systemd, i.e. PID 1 and that context nothing is supposed to be assumed14:45
robjoI agree with your reasoning but for some reason systemd early execution environment doesn't appear to be the same14:46
smoserwell you're suggesting i assume that blkid is /sbin/blkid14:46
smoseraren't you?14:46
robjoI do not know if we decided to fiddle with it or the Ubuntu systemd maintainers14:46
smoserhttps://coreos.com/os/docs/latest/using-environment-variables-in-systemd-units.html14:46
robjono, where I am actually going with this is a question about he generator itself and why it should exist14:47
smosermaybe htts not the right link.14:47
smoserbut surely some way you can change the PATH environment of PID114:47
robjobut this is not a unit file, it's the generator14:47
robjohttps://www.freedesktop.org/wiki/Software/systemd/Generators/14:47
smoseryeah.14:51
smoserhttps://www.freedesktop.org/software/systemd/man/systemd.environment-generator.html maybe ?14:51
smoseri dont know how the path gets set on ubuntu.14:51
smoseri'm not entirely opposed to adjusting PATH but it just seems like the wrong way to do  things.14:52
smoserand i am pretty solidly opposed to cloud-init having to set PATH in other places.14:53
robjoWell I can chase the PATH issue by asking our systemd maintainers and when I have a better understanding we can maybe revisit if needed14:54
robjobut what I really want to do is drop the generator from my package all together14:54
robjobased on me looking through the code ds-identify tries to do what each data source is doing already14:55
robjoso why probe twice?14:56
robjoif ds-identify doesn't run the Python code still finds the datasource and gets it's data14:56
smosercorrect. it is supposed to operate without ds-identify.14:56
smoserthe thing that it can't do without ds-identify is completely disable itself.14:57
smoserie, if ds-identify doesn't find anything then cloud-init.target will not be targetted.14:58
smoserand no bottlenecks imposed as a result of that.14:58
smoserand no python code run at all in boot14:58
smoserie, you can install cloud-init on your ubuntu desktop and its completely inert (other than the generator running).14:58
smoserhttps://mail.python.org/pipermail/python-dev/2018-May/153296.html14:59
robjofair, but if I impose cloud-init should be used/installed and services enabled only in an environment where it is actually useful then the "check if I should run" becomes kind of unnecessary14:59
smoserthat is true. bu the value of ds-identify also comes from trimming the DataSource list.15:03
smoserso less code runs in python too15:03
smoserbut more code in shell15:03
smoserso...15:03
robjoproblem is if it fails the Python code, which in this environment then actually works, never gets a chance15:04
robjoin a test where we set the full path ds-identify still failed, i.e. no data source was found15:05
smoseryeah.15:05
smoseri'm fine with simply PATH=$PATH:/sbin:/usr/sbin:/bin:/sbin15:05
smoserbut honestly you should chase having a sane environment15:06
robjobut when forced in that environment, i.e. ds-identify returned true, then cloud-init found a datasource and configuration worked15:06
smoserbecause i'm not the only person that assumes sane environment15:06
robjoI will chase that, composing an e-mail this minute15:06
smoseri'm pretty confident that ds-identify as it is riht now will improve boot speed15:09
robjobut we run the risk of not configuring the system at all15:11
smoserwell, thats a bug. we can fix it. you can just hard code the PATH.15:23
smoserwhen using software, you do run the risk of bugs.15:23
smoserbut suggesting you should not use software because of that is not really an option15:24
smoserrobjo: fyi15:32
smoser$ sudo cat /proc/1/environ | tr '\0' ' '  ; echo15:32
smoserHOME=/ init=/sbin/init recovery= TERM=linux drop_caps= BOOT_IMAGE=/boot/vmlinuz-4.15.0-20-generic PATH=/sbin:/usr/sbin:/bin:/usr/bin PWD=/ rootmnt=/root15:32
smoseri'd be interested in seeing what you have there.15:33
smoserinteresting. but in a container:15:34
smoser$ lxc exec x1 cat /proc/1/environ | tr '\0' ' '; echo15:34
smosercontainer=lxc15:34
smoserthats *it* no PATH there. i'm not sure what ds-identify has for path there. i'll check.15:34
smosereven in that container environment i get15:36
smoser PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin15:37
smoserand... robjo seems like it comes from15:38
smoser# strings /lib/systemd/systemd | grep PATH=15:38
smoserPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin15:38
robjocat /proc/1/environ | tr '\0' ' '  ; echo produces a very long list of things, weeding through it15:39
smoserthats odd.15:39
robjo PATH=/sbin:/bin:/usr/sbin:/usr/bin15:40
smoserin systemd:15:41
smoser src/basic/path-util.h15:41
robjowhich does make sense because in the images we build there is no issue with ds-identify or I would have found this a while ago15:41
smoser#define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"15:41
robjoso that makes me think that the party complaining is also fiddling with stuff they shouldn't15:42
smoserhttps://git.launchpad.net/ubuntu/+source/systemd/tree/src/basic/path-util.h#n3115:45
robjosmoser: thanks for digging all of this up much appreciated15:46
smoserupstream trunk much harder to read15:47
smoserhttps://github.com/systemd/systemd/blob/master/src/basic/path-util.h15:47
=== blackboxsw is now known as blackboxs
=== blackboxs is now known as blackboxsw
smoserblackboxsw: https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/34373817:09
smoserupdated17:09
blackboxswsmoser: approved the above,  parting comment for us to chat about some standup19:19
blackboxswjust confirmed this yaml.load issue in cloud-init for utf-8 https://bugs.launchpad.net/cloud-init/+bug/1768600 seems fairly signification for someone presenting their own runcmd info that could contain printable utf-8 chars.19:21
ubot5Ubuntu bug 1768600 in cloud-init "UTF-8 support in User Data (text/x-shellscript) is broken" [Medium,Confirmed]19:21
smoser:-(19:48
* blackboxsw is working up a quick unit test for robjo 20:25
blackboxswthx for the branches20:25
robjoblackboxsw: thanks20:26
robjothere didn't appear to be a distinct place where we test the config for stage handling20:27
robjoand the tests that run through stages.py confused me :(20:27
blackboxswyeah robjo that stuff (init/stages/and cli main) are pains and not very testable. I started some of it in cloudinit/cmd/tests/test_main.py which I'm adding to now for your branch.20:28
blackboxswso it's hard to tell people they should add tests there because those tests and ugly/mock hells20:28
blackboxswyeah I want cloudinit/tests/test_stages.py, but again haven't yet done that overhaul to pull all tests from tests/unittests to the appropriate tests subdir next to each cloudinit module20:29
blackboxswit's going to be a long manual crank on that one20:29
dpb1blackboxsw: for the metadata unification.. do we have the 6-10 fields that we want to name?22:00
dpb1instance_id, etc22:00
blackboxswdpb1: currently we have only22:13
blackboxsw "v1": {22:13
blackboxsw  "availability-zone": null,22:13
blackboxsw  "cloud-name": "nocloud",22:13
blackboxsw  "instance-id": "myb1",22:13
blackboxsw  "local-hostname": "myb1",22:13
blackboxsw  "region": null22:13
blackboxsw }22:13
dpb1ok22:13
dpb1thx22:13
dpb1is that in a card somewhere?22:14
blackboxswI think we are missing probably around 5 fields from the initial cut I took. I'll draw up a doc and card (as I have to refresh my memory on the cloud-instance data we see nowadays22:14
blackboxswI only spiked in NYC and left it to undocumented as I initially hit some datasource generalization issues that'd have to be resolved first22:15
blackboxswdpb1: I did capture std instance-data on a few clouds here https://forum.snapcraft.io/t/feeding-cloud-init-data-to-snapd/3474/21   because as you know, if it's not on snapforums it doesn't exist ;)22:16
blackboxswI'll do a quick review of those to see what we can pull out of the 'ds' related keys provided by the datasources22:17
* blackboxsw was thinking instance.type, network related information as initial attributes22:18
blackboxswbut there will be bit of work first to pull that content out of certain datasources , like OpenStack's network_data.json needs to be represented in our instance-data.json format22:21
dpb1the snapcraft forum?22:30
dpb1what22:30
dpb1blackboxsw: your pastebin's there are meant to be your example of what *would* show up, right?22:30

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