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

sirhopcountQuick question related to datasources. The 18.3 documentation has reference on how to configure them but not on how to use them. I'm trying to set the availability zone in the content of a file. I tried using the syntax of the most docs: Availability_zone: {{ v1.availability_zone }} but for some reason the v1.availability_zone isn't interpreted. Does 18.3 support the use of datasources and if so what am I doing wrong?11:34
meenasirhopcount: "I'm trying to set the availability zone in the content of a file. I tried using the syntax of the most docs:" where you setting that14:37
sirhopcountI'm creating a file using 'write_files:` and I use that in the 'content: |' section.14:38
meenai am suddenly more confused than ever14:39
meenafor what is this configuration? where are you writing that file?14:40
sirhopcountIt's a cloud-config file for AWS.14:40
sirhopcountmeena: This is an example of what I'm trying to do: https://gist.github.com/sirhopcount/6873745c1de6a830cb40ab0b26e402d914:46
rharpersirhopcount: you need tag the file with the jinja template key,  ## template: jinja15:55
rharperthat needs to be the very first line in your cloud-config file15:55
rharperthis tells cloud-init to run your config through the template renderer which expands the {{ }} keys15:55
rharperhttps://cloudinit.readthedocs.io/en/latest/topics/instancedata.html   *search for jinja*15:56
sirhopcountrharper: thanks!16:04
rharpersirhopcount: yw16:06
sirhopcountrharper: I might be mistaken but that feature doesn't seem available in 18.316:17
rharpersirhopcount: yes, 18.3 was tagged in June 2018, feature landed in Sept 2018, 18.4 tagged Oct 2, 2018;16:26
rharpersirhopcount: so you'll need 18.4 or newer16:26
sirhopcountthats to bad, Debian Buster ships with 18.3 and I don't think there is an easy way for me to upgrade.16:26
sirhopcountthanks for the help anyway :)16:27
rharpersirhopcount: sure;  is there a newer release in downstream in testing ? or unstable ?16:27
sirhopcountBullseye seems to have 19.4-216:28
sirhopcountbut the buster backports repo doesn't seem to contain it.16:31
sirhopcountDebian might but be considered stable but the facts they deploy with "old" software versions has more then once bitten me. I prefer Ubuntu over Debian but unfortunately its not up to me in this case.16:35
rharpersirhopcount: I see, bummer16:39
sirhopcountmm seems the debian apt repo does contain a cloud-init_19.4-2_all.deb which seems to install just fine. Going to test with that.16:42
blackboxswrharper: yaml on kernel commandline is not as easy as we thought as we are parsing that cmdline spliting on spaces. valid yaml for {'config': 'disabled'} is actually "config: disabled" with a space otherwise yaml.load interprets "config:disabled" as a single concatonated key which gets loaded as {"config:disabled" : None}19:20
rharperblackboxsw: yes, the space is required, is the parsing code eating the space ?19:20
rharperI see the tok is done with split()19:21
blackboxswrharper:  no, yaml.load needs that space. and if we present a kernel cmdline with that space, then our handling in tok split breaks19:21
rharperblackboxsw: ok, then maybe we want to regex for the disabled only19:22
blackboxswbut I'm thinking generally about kernel cmdline parsing if allowing spaced in cmdline values could break other things19:22
blackboxsw*spaces19:22
blackboxswrharper: I think possibly, but seeing if we can be more flexible than that19:22
rharperwe also have cc this is cloud config parsed end_cc;19:23
rharperblackboxsw: see util.read_cc_from_cmdline19:24
rharperso, the proper cmdline would be cc: network-config: {config: disabled} end_cc19:25
blackboxswrharper: yeah that makes more sense19:25
blackboxswgood suggestion19:26
rharper>>> from cloudinit import safeyaml19:26
rharper>>> safeyaml.load(util.read_cc_from_cmdline("foobar cc: network-config: {config: disabled} end_cc wark"))19:26
rharper{'network-config': {'config': 'disabled'}}19:26
blackboxswand good  fix suggestion :)19:27
rharperand then lastly, we need to decide, if we support the explicit:  network-config={config: disabled}19:28
rharperI think doc-wise, we should check that disable_string is in the cmdline19:28
rharperif 'network-config={config: disabled}' in cmdline:  then return {'network-config': {'config': 'disabled'}}19:29
blackboxswrharper: if we are supporting a one-off, non-yaml string. why not just network-config=disabled19:29
rharperI think that closes the bug19:29
rharperbecause we documented it the other way ?19:29
rharperI'm open to suggestion  here19:29
rharperclearly no one is using it19:30
rharperas it doesn;'t work19:30
rharperso, we could update the docs with all methods that work now (without any changes) for example the cc: .... end_cc19:30
blackboxswhrm I'm on the fence. I like simple ways to globally disable something, but writing an example cc: end_cc may advertise that more flexible functionality19:31
blackboxswwhich folks could better leverage for bigger c-config changes19:32
rharpersince the current doc is broken as it is;  do we support that documented string ?19:32
rharperI'm find with saying , no; that's broken;  instead use:  network-config=disabled;  and support that;19:33
rharperseparately we can file a bug on documenting use of cc: / end_cc;  and figure out if cloudinit/net/cmdline.py should be employing read_cc_from_cmdline() (try this first, followed up by search for network-config) etc19:33
rharperI think the non-encoded yaml only works if it's wrapped in cc: end_cc19:34
rharperas you mention, the spaces are needed19:34
blackboxswI not even sure we can/should be supporting the documented string  "network-config={config: disabled}" with the space because that type of kernel commandline I don't think conforms to typical k=v seen on kernel commandlines. So other cmdline parsing tools may break as a result if cloud-init *did* support that.19:35
blackboxswbut I'm good with documenting a simple network-config=disabled  or more complex cc... end_cc options too19:36
rharperblackboxsw: yeah; I think you're right there as well19:36
rharperyes19:36
blackboxswrharper: I just thought about the cc end_cc  approach we use too, might also break those same cmdline parsing tools that are out there anyway19:36
rharperso to fix the bug, 1) update docs to metion network-config=disabled 2) add this to the cmdline.py19:37
blackboxswbut, that's a separate issue19:37
rharperblackboxsw: well, they'll ignore it19:37
blackboxsw+1 on 1 and 219:37
rharpercool19:37
rharperand we can follow up with documenting cc/end_cc separately19:37
rharperand the refactor around b64/gzip stuff;  low-hanging fruit cleanup19:37
blackboxsw3) would you like cc/end_cc docuemented option for disable in the rtd docs too?19:37
blackboxsw+1 on your statements up until now19:38
blackboxswI'm good with document 3 too. and we can followup later if this is a breaking behavior for others in cloud-init that we need to address (but as you said, it probably isn't something that breaks cmdline parsing folks as they'll ignore things they don't care about)19:39
rharperI dunno about (3);  I suppose we should test whether that works as well (it should, I know I've tested a cc: some cloud config here end_cc for ssh_import_id19:39
rharperwe can hold off on (3) I think, as you mentioned, then folks are wondering in general about cc: end_cc; and I'd rather document that fully else where and then we could add a disable network cc:end_cc and refer to the cc:end_cc docs for more details19:40
blackboxswyeah and for 3 we do that for https://github.com/canonical/cloud-init/blob/master/doc/examples/kernel-cmdline.txt19:41
blackboxswyeah something separate19:41
blackboxswok19:41
blackboxswgot it will post this PR within the hour19:41
rharpercool19:44
blackboxswrharper: question at this point is if we will ultimately support cc ... end_cc for network-config on the commandline. As it is currently, merged config dict looks like it might ignore the network-config=base64-stuff and only rely on util.read_cc_from_cmdline. so we may have a gap there too in terms of merged network config.20:04
blackboxswI think there is a separate bug here that would be helpful to address when we address 3) adding cc ... end_cc documented option for network-config cmdline setup20:05
rharperblackboxsw: I suspect because if cc/endcc being under-advertised that we've got merge gaps; so let's file a bug for that and we can fix that separately20:05
blackboxsweven more reason to address separately20:05
rharperack20:05
blackboxswyeah20:05
blackboxswrharper: so, do we drop the documented yaml support https://cloudinit.readthedocs.io/en/latest/topics/network-config.html#default-behavior ?20:13
rharperit's supported but only if it's b64 encoded20:15
rharperit was the line about, you can disable this with network-config={config: disabled} on kernel cmdline;  that gets moved to network-config=disabled, and we need to *bold*/*note* the yaml stablement that it requires b64 encodingin20:15
rharperblackboxsw: ^20:15
blackboxswrharper: I was wondering about the text20:17
blackboxswip= or network-config=<YAML config string>20:17
blackboxswrharper: I was wondering about the text     ip= or network-config=<YAML config string>20:17
blackboxswwe can't really support YAML config string currently20:17
rharpers/YAML config string/Base64 encoded YAML config string20:18
blackboxswroger20:18
blackboxswthanks20:18
blackboxswrharper: https://github.com/canonical/cloud-init/pull/23220:48
rharperthanks20:48
Goneri@blackboxsw, the NetBSD PR is ready for review https://github.com/canonical/cloud-init/pull/62 :-)21:11
blackboxswrharper: thoughts on this for focal? https://trello.com/c/wepeWcKf/1109-ec2-support-secondary-ip-addressses-on-eth021:13
blackboxswGoneri: +1. will spend get you an update today.21:13
Goneri:-) awesome, I will rebase the OpenBSD branch this weekend if this one get merged this week21:14
rharperblackboxsw: +1, we need FFE and I left review on it; haven't looked again, but generally wondered about whether we also need the route-metric and dhcp*-override like we have on azure21:17
blackboxswok rharper so I have 2 FFEs: instance-data to include merged_cfg and and ec2 secondary ip address support21:18
rharperyeah, I think so21:19
blackboxswok I fixed ci for https://github.com/canonical/cloud-init/pull/230 I found an httpretty.last_request() that *is* available on xenial httpretty v 0.9.621:21
blackboxswrharper: so that first bug fix for ec2 redact should be good to go21:22
rharperblackboxsw: let me re-review21:22
rharperI had one nit on docstring21:22
blackboxswand I'm teasing out the bug-fix from feature-request for instance-data top-level keys @ https://github.com/canonical/cloud-init/pull/21421:22
ahosmanMSFTblackboxsw:21:22
blackboxswwill push a separate BR for the bugfix21:22
blackboxswhi ahosmanMSFT21:23
ahosmanMSFTHey blackboxsw what would be the best way to keep our repo of cloudinit up to date with upstream and have the debian salsa packages included, without having to do it manually?21:23
blackboxswahosmanMSFT: not sure I understand the question, you mean how can you get latest cloud-init in a debian salsa based image?21:26
blackboxswor are you looking for how best to install salsa debs on an ubuntu system?21:28
ahosmanMSFTsomething like this https://salsa.debian.org/cloud-team/cloud-init21:28
ahosmanMSFTblackboxsw: We have a branch of cloud-init with some changes, I was wondering what the best way to get debian salsa packages on there and also keep everything up to date21:31
ahosmanMSFTcurrently we have a manual approach21:31
blackboxswahosmanMSFT: I think that project is owned by debian devs to get cloud-init updated/maintained in debian proper. I see the committers are names that don't participate in cloud-init upstream as far as I can tell21:32
blackboxswyou might be able to touch base with Noah or Thomas listed as debian salsa maintainers there https://salsa.debian.org/cloud-team/cloud-init/-/commits/master/21:33
blackboxswahosmanMSFT: since we don't control when specific distributions pick up cloud-init upstream changes, each distro differs (besides Ubuntu which we *do* control)21:33
ahosmanMSFTblackboxsw: thanks that helps, I'll try getting in contact with them21:34
blackboxswahosmanMSFT: you might be able to trigger your own deb package builds via using cloud-init's packages/bddeb in our source tree to roll your own cloud-init upstream deb if that helps too21:35
ahosmanMSFTThat might be better, or we would have to rely on debian releases to update our cloud-init21:35
blackboxswahosmanMSFT: you could also try using cloud-init's ./tools/run-container --package  debian/10 #  to build a deb from source on a debian container21:36
rharperblackboxsw: one challenge is not using Debian's debian/ packaging dir21:37
blackboxswthat tool should create a binary deb for you from whatever your latest commit is in your local directory21:37
rharperwhat you really want is git checkout cloud-init.git; git merge /path/to/debian/cloud-init/git/branch/with/debian-dir-changes21:37
rharperwhich is like our daily-ppa for our release branches21:37
rharperthat'd be cloud-init-daily-debian21:38
rharperwhich is what I think would be desired21:38
ahosmanMSFTWould that also have the debian salsa packages or is it jsut a cloud-init met to work on debian21:40
ahosmanMSFTI think I see what you mean rharper, If we merge latest cloudinit and debian upstream changes we can get the best of both21:43
ahosmanMSFTThat might just work21:43
blackboxswthanks rharper fixed docstr https://github.com/canonical/cloud-init/pull/23021:43
rharperblackboxsw: ok21:43
blackboxswalso closed 221 as that was my first cut of 230 that we didn't merge last week21:43
rharperblackboxsw: approved, I'll leave to use to wait on CI and squash/merge21:45
blackboxswthanks21:49
blackboxswrharper: I forgot what did you suggest for top-level instance-data key for merged config instead of 'ci_cfg'21:50
rharperwe discused merged_cfg or merged_config21:51
rharpersomething indicating it was combined21:51
blackboxswok will go with merged_cfg21:51
* blackboxsw saving those keystrokes one step at a time21:51

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