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

masbergood morning, is this the right place to talk about cloud-init? I have an issue I would like to discuss01:46
smosermasber, it is the right place.05:53
smoserbut i'm about to go afk.05:53
masberoh05:54
smosermasber, i'm US/Eastern.05:55
masberok im Australia/Eastern05:56
smoserfile a bug and paste a link here https://bugs.launchpad.net/cloud-init/+filebug05:56
smoseri'm going afk. good night.05:56
masberok good night05:57
=== sambetts|afk is now known as sambetts
=== shardy is now known as shardy_lunch
=== shardy_lunch is now known as shardy
=== rangerpbzzzz is now known as rangerpb
=== cpaelzer_ is now known as cpaelzer
dgarstangIs there any way to pass the output of a script to the hostname to be set by cloud-init ?13:59
HawsonGood $time_of_day everyone14:25
HawsonI'm running version 0.7.5-10 (the version packaged with Centos 7), trying to provision some AWS instances.  The instances come from a custom AMI, but there are a few things that need to happen after the instance is launched.  Specifically, I'm tryting to run some commands via "runcmd", but I can't find any evidence that they actually get run.14:34
powersjrharper: https://copr.fedorainfracloud.org/coprs/g/cloud-init/cloud-init/build/562061/14:35
Hawsonthe /var/lib/cloud/instance/<instanceID>/scripts/runcmd file is properly created, and has the expected contents....14:35
rharperthx14:35
Hawsonbut it never seems to actually tun.14:35
powersjsmoser: https://copr-be.cloud.fedoraproject.org/results/%40cloud-init/cloud-init/epel-7-x86_64/00562061-cloud-init/root.log.gz14:35
Hawsongrep -i runcmd /var/log/cloud*14:35
Hawsonalso turns up nothing14:35
smoserHawson, hey.14:36
smoseri suspect that the cloud-final systemd job is not running14:37
* Hawson tips his hat to smoser 14:37
HawsonI checked that, actually14:37
rharper https://copr-be.cloud.fedoraproject.org/results/%40cloud-init/cloud-init/epel-7-x86_64/devel/repodata/repomd.xml14:37
Hawsonand it looks like it is...14:37
Hawsonsystemd "says" it ran successfully....14:37
smoserHawson, i assumethere isnt much in /var/log/cloud* right ?14:38
Hawsoncorrect, not much in the logs14:38
HawsonJun  6 21:55:08 localhost cloud-init: Cloud-init v. 0.7.5 running 'modules:config' at Tue, 06 Jun 2017 21:55:08 +0000. Up 9.64 seconds.14:38
HawsonJun  6 21:55:09 localhost cloud-init: Cloud-init v. 0.7.5 running 'modules:final' at Tue, 06 Jun 2017 21:55:09 +0000. Up 10.18 seconds.14:38
HawsonJun  6 21:55:09 localhost cloud-init: Cloud-init v. 0.7.5 finished at Tue, 06 Jun 2017 21:55:09 +0000. Datasource DataSourceEc2.  Up 10.39 seconds14:38
rharperImportError: No module named six14:38
rharperhttps://copr-be.cloud.fedoraproject.org/results/%40cloud-init/cloud-init/epel-7-x86_64/00562061-cloud-init/build.log.gz14:38
HawsonI should note that one of the scripts I want to run is expected to take many seconds (upto a minute or two) to complete14:38
Hawsonso for it to finish is about a quarter second is...suspicious. :)14:39
Hawsonbootcmd: operations *do* run, however14:40
powersjsmoser: rharper: this is the spec file I used to get those builds to go: https://git.launchpad.net/~powersj/cloud-init/tree/packages/redhat/cloud-init.spec?h=redhat-spec14:41
smoserHawson, /etc/cloud/cloud.cfg.d/05_logging.cfg14:43
smoserint hat file , can you comment out14:43
smoser- [ *log_base, *log_syslog ]14:43
smoser(just add a '#' at the beginning)14:43
smoserthen rm -Rf /var/lib/cloud* /var/log/cloud-init*14:44
smoserand reboot14:44
HawsonThere's a stanza for "_log:"14:44
Hawsondo anything with that?14:44
smoserat the bottom14:45
smoserlog_cfgs:14:45
smoser ...14:45
Hawson_log: is at the top, actually.14:45
smoserthere should be a line like14:45
smoser- [ *log_base, *log_syslog ]14:45
Hawsonthe lines you are talking about are at the bottom14:45
Hawsonalready commented out and bouncing14:45
smoserHawson, now i understnad your confusion14:46
smoser"at the beginning". i meant "at the beginning of the line"14:47
HawsonI understand your confusion at my confusion. :)14:47
HawsonAnyhow, host is up.  checking logs14:47
Hawsoninteresting though--lots more outptu this time around.14:47
* Hawson thinks I should disable syslog in general...14:48
Hawsonnot really much better.14:50
Hawsonbetter logs, but still not actually running the script.14:50
Hawsona few lines about calling cc_runcmd, writing the actual file, but not actually running them14:51
Hawsonhmmm...14:53
Hawson2017-06-07 10:46:44,671 - importer.py[DEBUG]: Looking for modules ['cc_runcmd', 'cloudinit.config.cc_runcmd'] that have attributes ['handle']14:53
Hawson2017-06-07 10:46:44,671 - importer.py[DEBUG]: Failed at attempted import of 'cc_runcmd' due to: No module named cc_runcmd14:53
Hawson2017-06-07 10:46:44,672 - importer.py[DEBUG]: Found cc_runcmd with attributes ['handle'] in ['cloudinit.config.cc_runcmd']14:53
Hawsonis that....normal?14:53
smoserHawson, there is a bug with systemd that coud-init starts writing there before syslog is really "up", so it goes to devnul14:55
smoser'runcmd' is not the name of the module that runs that stuff.14:55
Hawsonsystemd is stupidly broken?  I'm *SHOCKED*!  Shocked, I say.14:56
Hawsonthat's just the module that writes out the script, it seems.... (looking at cc_runcmd.py now)14:57
Hawsonso that brings up the question:  what *does* actually execute the script?14:58
smoserscripts-user14:59
Hawsoneh....okay.  I don't see any indication of scripts_user exec()ing scripts/runcmd15:02
HawsonI _do_ see lines like:  "helpers.py[DEBUG]: Running config-scripts-per-once using lock...."15:04
Hawsonsmoser: if scripts-user handles the actual exectution, and runcmd merely generates a script, what am I missing to get one to talk to the other?15:20
* Hawson is somewhat confused about the execution flow here.15:20
Hawsonalthough...https://git.launchpad.net/cloud-init/tree/config/cloud.cfg  implies that runcmd happens in the 'config' stage, not final?15:22
smoserHawson..15:24
smosersorry.15:24
smoserso the default config is that the 'runcmd' module runs earlier, but all it does is write files that are executed later by scripts-user15:25
HawsonOkay.15:25
smosercan you post /var/log/cloud-init.log and /var/log/cloud-init-output.log15:25
HawsonSo here's a dumb question.... :)15:26
HawsonI have stanzas for cloud_init_modules:, cloud_config_modules: and clout_final_modules:15:26
Hawsonnone of them have runcmd in them....15:26
* Hawson inherited this setup from someone else15:26
smoserHawson, well, you need 'runcmd' to read your 'runcmd:' stanza and render that into /var/lib/cloud/instance/per-instance/... (i think thats the path)15:28
smoserthen you also need 'scripts-user'15:29
Hawsonyeah, that's the path15:29
smoseror you wont *execute* what the other wrote15:29
Hawsonhmm.15:29
Hawsonthis may be a timing issue then15:29
Hawsoncloud_https://pastebin.com/gBGMbEVL15:30
Hawsonehh..15:30
Hawsonhttps://pastebin.com/gBGMbEVL15:30
smoseryep15:30
smoseryeah, those are wrong order15:30
smoserjust move runcmd up15:30
HawsonYep.15:30
* Hawson kicks off the AMI baking...15:31
HawsonThe *REALLY* annoying part of this is that what I'm trying to get running is a 100% useless waste of time. :-(15:31
Hawsonand I've spent a lot of time getting it working (not just with cloud-init)15:32
Hawson...we build an AMI with packer...that runs puppet...then calls cloud-init after boot.15:34
* Hawson looks around for more bailing wire and duct-tape15:34
smoserHawson, i'm sorry that 'runcmd' as the module doesnt actually do the running15:35
smoser(that is very confusing...)15:35
HawsonHeh, yeah.  That's kinda confusing.  :)15:35
HawsonI do appreciate the help though.15:35
smoserrharper,15:36
smoserhttp://paste.ubuntu.com/24801194/15:36
powersjhttps://copr-be.cloud.fedoraproject.org/results/%40cloud-init/cloud-init/epel-7-ppc64le/00562449-cloud-init/build.log.gz15:38
powersjsmoser: ^15:38
blackboxsw%{?systemd_requires}15:44
blackboxswper https://fedoraproject.org/wiki/Packaging:Scriptlets15:44
Hawsonwoohoo!15:51
Hawsonit's running this [CENSORED] script at boot.15:51
Hawsonawesome15:52
Hawsonkinda15:52
Hawsonthe cloud-init bit is awesome.  The script is a steaming pile of [censored]15:52
* Hawson owes smoser a beer15:52
smoserglad we could help.15:53
HawsonI do suggest a bit of clarification in the docs though.15:53
=== sambetts is now known as sambetts|afk
rharperhttps://copr.fedorainfracloud.org/coprs/g/cloud-init/cloud-init/build/562456/16:08
* rharper crosses fingers16:09
rharpersmoser: http://paste.ubuntu.com/24802038/   specfile template fixes works for el6/el718:03
powersjrharper: https://docs.pagure.org/copr.copr/how_to_enable_repo.html#how-to-enable-repo18:17
rharperhttps://copr.fedorainfracloud.org/coprs/alonid/yum-plugin-copr/18:20
powersjyum copr enable @cloud-init/cloud-init18:21
rharperfancy18:21
rharperok18:31
rharperhttp://paste.ubuntu.com/24802167/18:31
rharperthat works in a fresh cent7 container18:31
Hawsoncan cloud-init fire off a script "in the background"?20:19
Hawsonvia runcmd?20:19
rharperHawson: I think typical bashism like disown would work (https://askubuntu.com/questions/611968/differences-between-command-disown-and-nohup-command-disown)21:04
HawsonHmm..."disown" is a new one to me21:09
smoserrharper, https://code.launchpad.net/~akaris/cloud-init/+git/cloud-init/+merge/32518621:50
rharperack21:53
rharperlarsks: working on the redhat spec in trunk, and for rhel7 seeing this issue https://github.com/tony/tmuxp/issues/111  ;  it appears that setuptools injects 'argparse' in requires.txt but in rhel7 argparse is part of python2.7 already22:30
rharperIs there an distro bug against setuptools?  I've not found one yet;  I'm thinking of sed'ing out argparse if we're el7 (or if python -c 'import argparse' returns 0)22:31
rharperlooks like it was still in our requirements; but we'll add it into the spec template only for el6 releases; then we can drop it from the requirements;  that should clean things up22:44
larsksrharper: isn't argparse a part of python 2.7 everywhere?23:34
rharperit isn23:35
rharpersorry23:35
rharperyes, it is23:35
rharperwe 've been dealing with 2.623:35
rharperwe've got it worked out now;   no longer including it in requirements.txt, and then in specfile for systems using py26, to include the dep as a BuildReq and Req23:35
larsksAwesome.23:35
rharperhttps://copr.fedorainfracloud.org/coprs/g/cloud-init/cloud-init/23:35
rharpersmoser: should be merging the branch to trunk soon (fixing tox) and then we'll have daily trunk builds  up23:36
rharperdefinitely look at the specfile template and push any other fixes or issues you see with it;23:36
rharperhttps://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/32519223:37
larsksI'll take a look!23:40
rharperlarsks: cool, thanks!23:54
rharpersmoser: https://copr.fedorainfracloud.org/coprs/g/cloud-init/cloud-init/build/562649/23:57

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