/srv/irclogs.ubuntu.com/2018/08/16/#cloud-init.txt

powersjblackboxsw, fyi it may not land as I gotta figure out what to do with the new vlan + proxy00:09
powersjI updated a bunch of jobs, but still need to debug the ci jobs00:10
blackboxswNo worries powersj.  Thanks for the heada up00:35
smoserblackboxsw: jenkins didn't like your aure branch02:08
braincod1Hello cloud-init devs!03:28
braincod1I have a userdata.sh that I would like to drop into /var/lib/cloud... it is not entirely clear to me (from the docs), if I can do that as-is with a bash script without migrating to cloud-init YAML DSL?03:30
braincod1I tried putting it under per-boot, but doesn't seem to work as expected03:34
=== braincod1 is now known as braincode
smoserbraincode: you're wanting shell script to be executed every boot ?03:42
braincodeYeah, it just provisions an EC2 instance03:43
braincodeThis one: https://github.com/umccr/umccrise/blob/master/deploy/roles/brainstorm.umccrise-docker/files/bootstrap-instance.sh03:43
braincodeI started to migrate it to cloud-init YAML, but there are some parts I would need to refactor (namely, env vars) for it to work with cloud-init: https://github.com/umccr/umccrise/blob/master/deploy/roles/brainstorm.umccrise-docker/files/cloud-init.yml03:44
smoserthat should generally work03:44
smoserhttp://paste.ubuntu.com/p/kBJCbWXdKJ/03:44
smoser https://github.com/umccr/umccrise/blob/master/deploy/roles/brainstorm.umccrise-docker/files/cloud-init.yml is confused.03:45
smoser#cloud-config03:45
smosermust be yaml formatted, and can do things lke you have there 'fs_setup:'03:45
smoserbut your 'sleep 10' is not useful there.03:46
smoserthe first half of that script... can be in a per-boot script03:46
smoseryou can put cloud-config things in /etc/cloud/cloud.cfg.d/99-your-stuff.cfg03:46
smoserbut those things must be valid yaml.03:47
braincodeYeah, the cloud-init one is work in progress03:47
braincodeThat's why is half-baked, sorry03:47
smoserhhttp://paste.ubuntu.com/p/QdDYygjNzd/03:48
smoser http://paste.ubuntu.com/p/QdDYygjNzd/03:48
braincode@smoser, I'm getting this out of dropping the shell script in per-boot: https://paste.ubuntu.com/p/5Tc33RtnQQ/03:48
smoserbut you should absolutely be able to put that shell script into /var/lib/cloud/scripts/per-boot03:49
braincodeYes, I know, work in progress, I'm focusing now on just the shell script for now03:49
smoser(probalby you want per-instance... so it only runs once per instance)03:49
smoserthen chmod 755 it03:49
smoserand it should be good03:49
smoserif its not executable it will be ignored.03:49
smoserif you have issues....03:49
smoseralmost certainly there is a 'WARN' in /var/log/cloud-init.log03:49
smoserand the output of such scripts is in /var/log/cloud-init-output.log03:49
smoser(if not redirected)03:49
smoseri might suggest in the script at the top you can redirect it yourself... as I did with the 'tee'03:50
smoser(03:50
smoserlong03:50
smoserscript03:50
smoserhere03:50
smoser) 2>&1 | tee /run/this-is-my-output.log03:50
smosermake sense ?03:50
braincodeYeah, thanks a ton! :D03:50
smoserbut if you weren't making the script executable, then cloud-init will ignore it.03:51
braincodeAlso not entirely clear to me from https://cloudinit.readthedocs.io/en/latest/topics/datasources.html how to get those AWS env vars I'm defining on the script?03:58
braincodegotta go, brb, thanks a lot @smoser!03:58
braincodeWhat I mean is that it is well documented where that json with all the instance-data sits, but it's not clear how to i.e fetch instance-id or region and then using it on the cloud-init.yaml? Am I allowed to call the python methods shown somehow from the YAML?04:16
blackboxswBraincode you are only a few days too early.  https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/33529004:18
blackboxswShould be able to use it in jinja templates04:18
blackboxswAs.soon as we land that branch04:21
braincodeHoho, awesome! :)04:32
braincodeThanks for the suggestions on the 755... it went a little bit further but not all the way it seems: https://paste.ubuntu.com/p/54Rmy8jpJD/06:19
braincodeThat is, with https://github.com/umccr/umccrise/blob/master/deploy/roles/brainstorm.umccrise-docker/files/bootstrap-instance.sh06:19
braincode... and I did not cut any further output at the end, that's it, all cloud-init executes from the scrip... wait a second, yeah, for sure it's about the Instance Role permissions07:01
nicolas17hi09:25
nicolas17on one of kde.org's servers, cloud-init decided that it has never run before09:26
nicolas17which means it eg. re-generated the ssh host keys09:26
nicolas17any idea why that can happen? I have logs09:27
nicolas17https://paste.kde.org/pl76fn3ks09:39
nicolas17I guess the error on line 498 may be it?10:02
powersjsmoser, blackboxsw ci is broken until I figure out the proxy14:31
smoseri noticed :)14:35
blackboxswsmoser: on your oracle instance I presume the commented #datasource_list: [ OpenStack ] in 99-oracle-bare-metal-datasource.cfg was you right for your dev/testing16:29
smoserblackboxsw: this is apita16:32
smoserright. i commented that out.16:32
smoserthis negative skip is annoying16:33
smoserand i'm not sure the one in DataSourceConfigDrive is done right...16:34
blackboxswyeah and  $ python3 -c 'from cloudinit.sources.DataSourceOpenStack import detect_openstack; print(detect_openstack())'16:34
blackboxswTrue16:34
blackboxswyes, the negative skip as a policy due to ds detection order stinks.16:35
blackboxswso I only recently added that OracleCloud.com asset_tag check to DSOpenStack.16:41
blackboxswdo we have different asset tags on OCI-classic vs. OCI16:42
blackboxswdoesn't appear to. /me grasps for some other env variable that'd be specific to oci-c only16:42
blackboxswas a 'pass' for DataSourceOpenStack.16:43
smoserno asset tags on oci-classic16:43
smoseruses ec216:43
smosernot covered here, not negaively affected here.16:43
blackboxswsooo, since the only add of 3cee0bf8 was enabling detection of DMI_ASSET_TAG_ORACLE_CLOUD, we can back that out with your Oracle Datasource introduction16:45
blackboxswright?16:45
smoserno.16:45
smoserbecause then we'd have to deal with "transfer"ing16:46
smoserblackboxsw: i'm currently confused at this16:47
smoser$ sudo python3 -c 'from cloudinit.stages import _pkl_load; print(_pkl_load("/var/lib/cloud/instance/obj.pkl").sys_cfg.get("datasource_list", "why is there no datasource_list"))'16:50
smoserwhy is there no datasource_list16:50
* blackboxsw hrm same on lxc... checking16:53
smoser$ sudo python3 -c 'from cloudinit.stages import Init; x = Init(); print(x.cfg.get("datasource_list"))'16:56
smoser['Oracle', 'None']16:56
smoseri thought that that was basically where the datasource got its sys_cfg16:56
smoserblackboxsw: sorry. i rebooted. cleaned and rebooted. seeing if it comes up different.16:58
blackboxswno worries smoser I'm on a container16:58
smoserwell at least it recreates.16:58
blackboxswsources.find_sources gets passed a valid/populated datasource_list17:02
blackboxswchecking to see what it does w/ self.cfg17:02
blackboxswchecking to see what it does w/ Init.cfg17:02
blackboxswsaves as ds.sys_cfg17:03
blackboxswhrm17:03
smoserso17:04
smoser sudo cloud-init clean --logs17:04
smoser sudo cloud-init init --local17:04
smoser sudo python3 -c 'from cloudinit.stages import _pkl_load; print(_pkl_load("/var/lib/cloud/instance/obj.pkl").sys_cfg.get("datasource_list", "why is there no datasource_list"))'17:04
smoseryou will see the datasource now17:05
smoser sudo cloud-init init17:05
smosertry again and it is not there.17:05
smosers/datasource/datasource_list/17:05
blackboxswhrm something w/ restoring from cache? not seeing that on lxc's nocloud datasource between --local and network stage runs.17:11
[42]i'm doing something wrong somewhere i believe17:21
[42]i'm setting a hostname in my user data and i can see it's set in /etc/hosts17:21
[42]but it doesn't seem to set the system hostname as i can see in /etc/hostname / hostnamectl17:21
[42]preserve_hostname is false17:22
[42]any ideas what could be blocking this?17:22
blackboxswdumb, lxc does reproduce17:25
blackboxswi was not printing the pkl'd object datasource_list, but Init's.cfg['datasource_list']17:25
blackboxswso upon reload of cache in network stage, datasource_list is dropped17:26
[42]i found https://git.launchpad.net/cloud-init/tree/doc/examples/cloud-config.txt#n29117:27
[42]how does it check for "not modified by user"?17:27
[42]does that even apply if it's set to false in /etc/cloud/cloud.cfg?17:28
=== brunobronosky is now known as Guest20404
[42]found it in /var/lib/cloud/data/previous-hostname17:32
blackboxswso logic for hostname set is here :   /usr/lib/python3/dist-packages/cloudinit/config/cc_set_hostname.py, it checks a previous-hostname cache file to compare hostname/fqdn against any previous cloud-init configured hostname. if cloud-init thinks hostname didn't change, it'll emit a log  "No hostname changes. Skipping set-hostname"17:32
blackboxswsorry took me a while to type. yes that's the cache cloud-init compares against17:33
blackboxswI'd expect you are seeing that Skipping... log in /var/log/cloud-init.log17:33
[42]i didn't see that line, might be due to the old debian cloud-init17:34
blackboxsw[42] is debian on 0.7.9 still? we've definitely overhauled a bit of the cc_sethostname logic a bit after that.17:35
[42]yes17:35
blackboxsw:/ yeah I don't think we have the same problem/behavior anymore. I believe we made the cc_sethostname a bit more flexible.17:36
blackboxswflexible/re-entrant17:38
blackboxswcc_update_hostname is the other module that is at play here17:39
blackboxsw... and there really shouldn't be two modules for this ultimately.... but we haven't yet aligned that behavior but we've talked about that a possible future17:41
smoser[42]:the intent is that it stores what it was previously17:43
smoserand if it is not what it was previously, then it assumes written by user.17:44
[42]smoser: yup figured that out17:44
smoseryeah.. /me catches up with backscroll17:44
[42]unfortunately others administrating these systems don't always invest enough time to figure out why things don't work to properly fix it rather than just quick fixing it on one system17:45
[42]which isn't useful when cloning a machine17:46
smoserblackboxsw: http://paste.ubuntu.com/p/cwBT2fNMHp/18:00
smoserblackboxsw: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1787459 <-- thats a bug for the sys_cfg problem18:17
ubot5Ubuntu bug 1787459 in cloud-init (Ubuntu) "datasource.sys_cfg gets different values in local stage and after." [Undecided,New]18:17
blackboxswalmost done w/ your review on original branch smoser. will check paste andbug in a few mins18:18
smoserblackboxsw: "a couple of nits about persisting variables"18:48
smoserbut i dont see comments i line18:48
smoserinlin18:48
smoserinline18:48
blackboxswbah, checking the submit button18:50
blackboxswok smoser so your paste you are allowing oracle as openstack if Oracle not in ds list. so old behavior persists for existing pets which are upgraded.  and there is not a world where ds-identify would report OpenStack on OracleCloud.com per your new changes, so looks safe from that front.18:56
blackboxsw+1 on your paste18:56
blackboxswsmoser: 6 unsaved comments posted on your oci branch18:58
smoserblackboxsw: https://meet.google.com/bxm-azib-mtj19:39
smoserblackboxsw: http://paste.ubuntu.com/p/V2qQ4BWtVg/20:52
blackboxswsmoser: looks good although the ci-b64: prefix not being processed to base64-encoded-keys. I can't decide if I care enough about the interim state of the data.21:04

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