/srv/irclogs.ubuntu.com/2014/03/31/#cloud-init.txt

smoserjclift, you culd just read /var/lib/cloud/instance/user-data12:42
smoserit wont have any meta-data tags, but will have the user-data.12:43
smoserand user-data.i is mime-multipart "pre-processed" (as in has consumed #include for you if you were interested in that).12:43
jcliftsmoser: Thanks.  Looked into that yesterday, but the way Rackspace does stuff, metadata doesn't get into userdata.13:25
jcliftFigured out a way of doing it though.13:25
jcliftsmoser: Does this seem terrible? https://forge.gluster.org/glusterfs-rackspace-regression-tester/glusterfs-rackspace-regression-tester/blobs/script_refactoring/snippets/metadata_retriever.py13:26
jcliftSaved that to git for a bit after figuring it out yesterday.  Investigating potentially alternative approaches instead atm.13:27
smoserjclift, you're right. metadata isn't going ot get into user-data.13:28
smosera feature that i've wanted to add in the past is 'cloud-init query'13:28
smosereither a cmdline tool, or a explicit promise of how you can load data from the cloud in a datasource agnostic way.13:29
smoserie, i think the answer might just be to dump json into /run some where.13:29
smoserbut we dont have that now. so what you have isn't horrendus. 13:30
jcliftYeah.  Could be useful.13:30
jcliftThanks. :)13:30
smoserand i doubt i would have even bothered sucggesting reading the 'system_info'['paths']13:30
smoserrather than just loading /var/lib/cloud/instance/obj.pkl13:30
jcliftHeh, was more of a "just in case", since I have 0 idea how things are structured on non CentOS.13:30
jcliftAnd Gluster Community has people on all different kinds of OS's that may try it out13:31
smoseryeah. its better in that sense.13:31
smoserhm..13:31
smoserso one thing you could do, is not use metadata13:31
smoserbut just user-data.13:31
smoseris there a reason for meta-data ?13:31
jcliftYeah, there's a 2K limit for user data, and I want to keep them separate13:32
jcliftAlso, I don't know how to do the multi-part stuff programatically yet13:32
smoserthe limit should be i think 16k, and it can be compressed.13:32
jcliftIt's definitely 2K with rackspace cloud13:32
smoserwell, it can at least be compressed.13:32
smoser2k is silly small13:33
jcliftIt's even documented as 10K in some places in source... but in practice their API rejects anything over 2K13:33
jcliftYeah, agreed13:33
smoser(and you can use '#include')13:33
jcliftYep13:33
jcliftDiscovered that yesterday ;)13:33
smoserbut #include increases complexity13:33
jclifteg https://forge.gluster.org/glusterfs-rackspace-regression-tester/glusterfs-rackspace-regression-tester/blobs/script_refactoring/remote_centos6.cfg13:33
jcliftYeah13:33
smosermultipart is really easy though to do programatically.13:33
smoseryou just throw whatever "parts" you want into a yaml list13:33
jcliftAhhh cool.13:33
jcliftk13:34
smoser(and yaml == json)13:34
jcliftSure13:34
jcliftI need to include a config file (eg as above), plus a script file to run afterwards (aka runcmd)13:34
jcliftTried listing both under an #include, but only the config file gets executed13:35
smoser?13:35
jcliftIt's on my ToDo list to figure out later on today wtf is going wrong there13:35
smoserthat should work.13:35
smoseroh.13:35
smoserit should work.13:36
smoser#include13:36
smoserhttp://url/113:36
smoserhttp://url/213:36
smoseryou just have to get the "startswith" right.13:36
smoserie, '#cloud-config' or '#!'13:36
smoserand cloud-init should do the right thing13:36
smoseranyway, other than being config-drive specific i dont think what you have there is horrendos13:37
jcliftYeah, that's what I tried yesterday. The config bit worked (first url), the 2nd didn't.  But I haven't looked through the cloud-init log to figure out why, even though I could see the 2nd URL was pulled down into user-data.i (or similar name, this is from memory)13:44
jcliftI'll look into it later on today, it's probably something simple. :)13:45
jcliftsmoser: Does this seem like a valid startswith? https://forge.gluster.org/glusterfs-rackspace-regression-tester/glusterfs-rackspace-regression-tester/blobs/script_refactoring/regression_test.sh13:45
jclifteg bash13:46
jcliftProbably nothing bash specific in there, so changing to /bin/sh instead would likely work straight off13:46
jcliftMeh, I'll investigate later.  Other things to finish first.13:46
jclift:)13:46
smoserit should, yeah, '#!' should be good enough.13:48
smoserjclift, regarding "obvious"13:51
smosermaybe that /usr/bin/bash doesn't exist ?13:51
jcliftHmmm, completely possible13:52
jcliftI'll check in a sec.  Filling forms for other stuff atm.13:52
smoseralso, one thing i'd suggest, is to set "cloud-init-output"13:52
smoseroutput: {all: '| tee -a /var/log/cloud-init-output.log'}13:52
smoserthat is the default in trunk now, but is extremely useful.13:52
smoserthat way any output of subprocesses of cloud-init goes there.13:53
jcliftUseful tip.  I'll look into it shortly. :)14:00
=== harlowja_away is now known as harlowja
jcliftsmoser: Interestingly, there's no flag file written by kernel updates for CentOS/RHEL/etc.18:11
jcliftsmoser: However, there's a yum "reboot_suggested" flag that gets written to yum metadata18:11
jcliftYum is written in Python18:11
jcliftAnd various parts of yum can be imported for use in python18:12
jcliftThere's an example of something called PackageKit using it here: https://gitorious.org/packagekit/packagekit/source/945faa959f00e27d419517116c37e960d6093f56:backends/yum/yumBackend.py18:12
jcliftIn theory, it might be possible to just do something like "from yum.update_md import UpdateMetadata", and get it working from there18:13
* jclift will experiment a bit, but my Python is very noobie level so you might be able to just glance at it and tell what to do. ;)18:15
jcliftSo, after speaking with the guys in the #yum channel, it looks like the reboot_suggested flag isn't that widely used.  So, may not actually be reliable.19:42
jcliftThey suggested just checking the version of the running kernel vs the latest installed one, and rebooting if they're different19:43
jcliftI'll see if I can whip up a suitable patch to do that in a bit.  Kind of brain faded atm tho :/19:43
smoserjclift, that sounds fine. 20:04
smoserits non-trivial to determine "latest kernel" though.20:05
smoseri dont know how one is supposed to do that. you'll probably have to use yum to compare versions.20:05
jcliftThey pointed me towards a recent yum command addition that does it.20:05
jcliftsmoser: I'll hunt that down and see if it's feasible to copy.  Yum being written in python too, etc.20:06
jcliftMay not be tonight though.  Kind of needing a break atm. :)20:06
smoseroh, its not reasnoable to copy.20:07
smoseryou'd want to use the library. iirc rpm's "which version is greater" is massive spaghetti.20:07
jcliftDamn.  This is apparently a new yum command, in recent Fedoras.  I haven't yet looked into it.20:17
jcliftYou could be completely right thogh.20:17
jcliftGuess I'll be finding out soon. ;)20:17
=== harlowja is now known as harlowja_away
=== harlowja_away is now known as harlowja

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