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

Rusty_AlmightySo, to define the question, how do I launch the installer from IPXE with an answer file that was generated and being served from a web address?05:26
Rusty_AlmightyExample: set params root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=http://${MYIP}/ubuntu-20.04-live-server-amd64.iso autoinstall ds=nocloud-net;s=http://${MYIP}/ubuntu-yaml.php05:26
Rusty_Almightythe nocloud-net data source is expecting a folder and very specific file names to be in their respective file locations. Is there a way to provide the meta-data and the user-data files as a single .yaml file provided by a single web page?05:28
meenaRusty_Almighty: 🤷🏻‍♀️07:30
meenathat sounds like a NoCloud specific question, so maybe go looking there for answers07:31
meenait does seem like NoCloud is one of the simpler datasourcres07:31
Rusty_AlmightyIs there a specific channel for only the nocloud data source?07:36
Rusty_AlmightyAlso, is there another source that will allow me to doe what I am talking about?07:37
meenahttps://pypi.org/project/cloud-init-seed/ this converts an existing image to one where the NoCloud seed is already mounted08:24
meenahttps://github.com/rmb938/vmw-cloudinit-metadata/ this could be what you're looking for, Rusty_Almighty08:28
meenaAlthough it claims that it's VMware specific08:29
meenayou might be able to extract some essence08:29
meenahttps://gist.github.com/smoser/635897f845f7cb56c0a7ac3018a4f476 this example by our own smoser  mounts the Filesystem08:33
meenaaaaaand it also says that NoCloud's "upstream" is *cloud-init*08:33
meenanow that's pretty embarrassing08:33
meenawe really should have a simple Metadaten08:34
meena*metadata Server08:34
Rusty_AlmightyI would agree. Looking through the source code there doesn't seem to be any way to define just a single answer file in any of the source providers.08:47
Rusty_Almightyhttps://github.com/canonical/cloud-init/blob/ubuntu/daily/focal/cloudinit/sources/DataSourceNoCloud.py08:47
otubolangjv, interesting. I'll make sure we document this vmware_extra_config='{"smbios.assetTag":"OpenTelekomCloud"}' on our knowledge base. Or, if it doesn't interfere on other clouds we could push it upstream as well. What do you think?12:00
adgudHey, how do I regenerate network config (for netplan)? Let's say I changed IP address in cloud-init source file and I would like this change to be applied.12:51
toolzI guess netplan apply ?12:53
adgudBut the netplan config file is not updated yet - I should mention that I'm using Proxmox and I changed cloud-init IP address in GUI12:54
paridehey rharper, on https://github.com/canonical/cloud-init/pull/482: I also noticed that sometimes images are exported as a single .tar.gz file. I think it depends in how the images was imported in the first place, and that doesn't seem to happen with imaged imported using the ubuntu: or images: remotes13:10
paridethe cloud_tests were limited on squashfs + tar.xz exports even before13:10
paridedo we need to support "combined" .tar.gz exports in cloud_tests?13:11
pariderharper, in any case not knowing what is going to be exported and guess is not nice13:25
parideI'm asking the LXD people13:26
Odd_Blokemeena: cloud-init doesn't, but Ubuntu ships all sorts of simple metadata servers: apache2 and nginx are the two most commonly used. ;)13:40
Odd_BlokeRusty_Almighty: This isn't exactly what you were asking for, but if you used something like `ds=nocloud-net;s=http://${MYIP}/ubuntu-yaml.php?document=` then you should get multiple requests to /ubuntu-yaml.php with different query data each time.13:43
Odd_Bloke(I'm looking to see if we already have a bug for all-in-one.)13:43
Odd_BlokeRusty_Almighty: And I can't find such a bug, so please feel free to use the link in the /topic to file such a feature request. :)13:50
Odd_Blokeotubo: We shouldn't be using `OpenTelekomCloud` anywhere other than https://open-telekom-cloud.com/en; can we identify why that string works and check if there's an alternative that isn't tied to a specific vendor's platform?13:55
Odd_Bloke(Specifically, we could potentially land changes to implement behaviour specific to OTC, which might then start being applied to people's VMWare VMs; it's unlikely that this is their desired behaviour. :)13:56
rharperparide: thanks;  yeah;  there's a real lack of formatting via the cli;14:03
smoserRusty_Almighty: well, the "seed" was essentially intended to be "a single answer file" per source14:05
smoseroh. i see the question Rusty_Almighty was asking. there is no way to provide both user-data and meta-data as a single file. i can see that might be useful, but its not really a big limitation.  files/urls are "free". 2 is not really any harder to serve than 1.14:07
Rusty_AlmightyBut I would at least need to be able to control the name for each file as a PHP with separate variables so that the file can be generated.14:09
smoserhttps://github.com/rmb938/vmw-cloudinit-metadata/ is interesting.14:09
Rusty_AlmightyI would also need to make changes to my web server to forward certain url's to php files which breaks the paradigm a little bit.14:11
smoserRusty_Almighty: it isn't that hard.14:12
smosercloud-init 'seed' of some url. and then cloud-init just appends 'user-data' and 'meta-data' to that url14:12
smoserphp or any other web server can look at the url and use it.14:12
smoserseed=http://my.address/instance/i-<your-id-here/14:13
smoseri dont know in php how to have one php file take all requests "under" a certain path.14:14
smoserbut certainly you could do:14:14
smoser seed=http://my.address/instance/server.php?id=<your-id-here>&name=14:14
smoserand cloud-init would just append 'user-data' and 'meta-data'14:14
smoserthen just look at the 'name' variable in php14:15
Rusty_AlmightyI'm not saying it couldn't. I'm just saying that the 53 other automatic installing operating systems that my ipxe server installs don't .  However, I'm liking this idea where we hack around the issue by providing a blank "document=" at the end of the get statement.14:16
Rusty_Almighty23*14:16
=== vrubiolo1 is now known as vrubiolo
smoserfwiw, its not a hack.14:19
smosercloud-init is doing string concatenation . urls are just strings.14:19
smoserurls no longer have to map 1:1 to a file in a unix filesystem.  thats a good thing.14:21
Odd_Blokesmoser: Having support for a single file would simplify things IMO; if people are just writing files to disk then then gain isn't massive, but if people are using some sort of framework (or PHP file) then _requiring_ two GETs makes things more complex than less.14:24
Odd_BlokeBecause you can't just implement a single endpoint which returns YAML, you have to either implement separate endpoints or implement logic based on query strings.14:26
Rusty_AlmightyApologies. pidgin on Ubuntu keeps crashing.14:26
meenaOdd_Bloke:    did you know at i'm an apache httpd committer?14:27
Rusty_AlmightyWhat was that last comment about making a single request?14:27
Odd_Blokemeena: I did not!14:27
meena(i haven't contributed in ages, because the ASF is quite exhausting, but, yeah)14:27
Odd_BlokeRusty_Almighty: "Because you can't just implement a single endpoint which returns YAML, you have to either implement separate endpoints or implement logic based on query strings."14:28
Rusty_AlmightySome one was saying that it would be easier to make a single web request.14:33
Odd_BlokeOh right, "Having support for a single file would simplify things IMO; if people are just writing files to disk then then gain isn't massive, but if people are using some sort of framework (or PHP file) then _requiring_ two GETs makes things more complex than less."14:33
Rusty_AlmightyOdd_Bloke: Yes. that would simplify things greatly in my specific case.14:35
smoserOdd_Bloke: "single endpoint" don't know what you mean.14:36
smoserthis isn't 1999.14:36
smosers3 is a "single endpoint"14:37
Odd_BlokeOK, well, I'm clearly not using it in that sense?14:37
Odd_Blokes/endpoint/route/ if that helps.14:37
smoserbaked into your thoughts is the idea that '/' means something.14:38
smoserits jsut a character in a string.14:38
Odd_BlokeWhat?14:38
Odd_BlokeDoes the current implementation require 2 GETs or can it only make 1 GET?14:38
smoseryou're right about 2 GETs.14:39
smoserand that *is* simpler. and then also "atomic"14:39
smoserso i'm not opposed to it.14:40
smoserbut, fwiw, no cloud that I know has chosen to implement things that way.14:40
smoserie, ec2 metadata, openstack metadata, hetzner ... they're all multiple GETs14:41
Odd_BlokeOracle has a separate GET for network metadata, but you can get metadata/user-data all as part of one GET from their new APIs.14:42
Odd_BlokeBut I agree that it isn't a general pattern.14:42
smoseryou'd have to send back in the resonpse some indication to cloud-init that this is a "nocloud combined" response.14:43
Odd_BlokeBut if I had to speculate, I'd say that isn't because that's what's best for the guest, it's because organisationally exposing all of the data from multiple different systems run by different orgs via a single GET is Complicated (TM).14:43
smoserwell.. i dont know.14:43
Odd_BlokeAlternatively we could introduce a new `seedcombinedfrom=` or whatever, so you explicitly opt into the combined behaviour.14:43
smoserultimately its a "single endpoint"14:44
smoserand you can either combine all the things when the client requests them individually or all at once.14:44
smoservalue in separate is less to deliver now.14:45
smoseranyway14:45
smoserso i'm not opposed to single14:45
smoseri'd like for it to work with directory also. such that you could /var/lib/cloud/seed/nocloud/<single-file>14:46
smoseryour suggestion for combined 'seedfrom' means that we don't have to "go fishing"14:47
smoserand see if there is a /<single-file> and then <user-data>/<meta-data>14:47
smoserantoher option would be to justs have cloud-init check 'meta-data' for a given format.14:48
smoserif it starts with '#nocloud-v2' or if yaml/json has 'type: nocloud' 'version: 2' ot something14:49
Rusty_Almighty2 requests are not impossible, maybe if we just had a way to provide what the file names were by allowing more keys to be passed to the data source.  eg. s=http://my-ip/some/folder/;m=meta-data;u=user-data15:17
meenahow did we go from providing a NoCloud dataserver that transforms one YAML file (per server) into the correct NoCloud format…to this?15:18
Rusty_AlmightyYou would think that something like this would be required for localization.  I'm pretty sure that some of the poor Russians out there have no idea what meta-data means.15:18
meenaor did i misunderstand what Rusty_Almighty was talking about to begin with?15:18
Rusty_AlmightyOr maybe I'm just stating to speak gibberish because I have only slept 4 hours for the past 48.15:19
Rusty_Almightymeena: Where is the best place to file a bug for the cloud-init project15:20
Rusty_Almighty?15:20
meenaRusty_Almighty:    in the /topic15:21
meenapull-requests https://git.io/JeVed | Meeting minutes: https://goo.gl/mrHdaj | Next status meeting July 14 16:15 UTC | 20.1 (Feb 18) | 20.2 (Apr 28) | https://bugs.launchpad.net/cloud-init/+filebug15:32
Rusty_AlmightyThanks. I got it from the topic. Filing now.15:34
Rusty_AlmightyThe way I see this is that this is 2 distinct problems. So maybe I should file 2 bugs.15:38
Rusty_AlmightyProblem 1. the file names "user-data" and "meta-data" are hard coded and cannot be changed.15:51
Rusty_AlmightyProblem 2. the installer is forced to make 2 seperate web requests which is not always very simple.15:52
smoser"installer" is odd.15:53
smoserthat is confusing15:53
Rusty_Almightysmoser: what would you call it?15:53
Odd_BlokeRusty_Almighty: cloud-init operates in already-installed generic images, to specialise them for this particular boot; something else has to do the "install" (e.g. subiquity, debootstrap, the Ubuntu cloud image build process) and include cloud-init before it can run.16:03
Rusty_AlmightyI filed it as a single bug, but would some one do me the pleasure of reading through my bug to make sure that we've documented everything we just discussed since I'm operating at compromised mental capacity at the moment?16:19
Rusty_Almightyhttps://bugs.launchpad.net/cloud-init/+bug/188684616:19
ubot5Ubuntu bug 1886846 in cloud-init "The nocloud-net data source requires a folder forcing 2 seperate web requests to hard coded files" [Undecided,New]16:19
smoserRusty_Almighty: it doesn't "require a folder"16:23
smoserit does require 2 GETs16:23
Rusty_AlmightyWell, it does require an open ended url which is folder like in nature.16:24
Rusty_Almightysmoser: how would you word it?16:24
Rusty_AlmightyAlso, if the data source is just plain old nocloud, then the URL is a folder.16:25
Odd_BlokeRusty_Almighty: It doesn't require a folder because the paths are determined by appending a string, not by path/URL "join"ing; so if the path you specify is /my/metadata- then cloud-init will read /my/metadata-user-data and /my/metadata-meta-data; you aren't forced to use a directory/folder (except insofar as most filesystems require files to be in directories ;).16:34
Odd_BlokeSimilarly, if you specified `http://example.com/metadata?type=` then your two GETs would be to `http://example.com/metadata?type=user-data` and `http://example.com/metadata?type=meta-data`.16:35
Odd_Bloke(I may be misremembering and getting the hyphenation of user-data and meta-data here completely wrong; apologies if so!)16:36
Rusty_AlmightyRenaming folder to "folder like string" then?16:38
Rusty_Almighty"The nocloud-net data source requires a folder like string forcing 2 seperate requests to hard coded locations"16:40
smoserjust drop "folder". requires 2 separate requests.17:06
smoserhttp has no explicit relation to folders.17:07
smoserthis is surprising to me17:54
smoseranyone else?17:54
smoser$ python3 -c 'import io; buf = io.StringIO("he17:54
smoserllo "); buf.write("world"); print(buf.getvalue())'17:54
smoserbah. paste fail.17:55
smoser$ python3 -c 'import io; buf = io.StringIO("hello "); buf.write("world"); print(buf.getvalue())'world17:55
smoseragain.17:55
smoserhttps://paste.ubuntu.com/p/Sz6t7hNsHk/17:57
smoserthere. that seems more sane.17:57
smosersane paste. i still think that is very odd behavior.17:57
Odd_BlokeThe docs do say "The stream is positioned at the start of the buffer."17:57
Odd_BlokeSo I think you'd need to do `buf.seek(0, whence=os.SEEK_END)`?17:59
Odd_Bloke(I agree it's unintuitive!)17:59
Rusty_AlmightyI believe the seek has to happen before you write.18:07
Rusty_AlmightyIE. you sert the buffer to hello and even though you did, the carrot is at 0 still. So when you write world, it overwrites hello.18:08
Rusty_Almightyhttps://paste.ubuntu.com/p/MVD8VsvyD2/18:10
Rusty_AlmightyOdd_Bloke is correct.  "buf.seek(0, os.SEEK_END)" before writing will get you what you want.18:16
meenasmoser: what happens when you flush? (at the end? at the beginning?)18:44
Rusty_Almightymeena: flushing at the end or at the beginning doesn't seem to affect the carrot.18:51
Rusty_AlmightyCarrot stays the same.18:52
smoserit makes sense if you think of io.StringIO("foo") as open(file, "rw") where 'file' already had "foo" inside it.18:55
Rusty_Almightysigh.. more problems...19:04
Rusty_Almightyhttps://paste.ubuntu.com/p/NM8z5KXjVW/19:04
Rusty_AlmightyThere is also no logs from my web server that the URL was accessed.19:06
=== jdoss_ is now known as jdoss
Odd_BlokeYeah, that message means that it didn't identify it as a valid URI to even attempt.20:26
Odd_BlokeI'm not sure why.20:26
Odd_BlokeRusty_Almighty: What was your kernel cmdline?20:28
Odd_BlokeRusty_Almighty: I'm leaving for today (and off tomorrow), so I'm afraid this will be my last contribution: my only guess is that you've specified nocloud not nocloud-net, which changes the prefixes that it would consider valid.20:32
Odd_Bloke(I think dsmode=net is a red herring there, but maybe it isn't and my guess is wrong! :)20:32
Rusty_AlmightySorry. Filing another bug with Debian. FIX ALL THE THINGS.20:48
Rusty_Almightyset theKernelParams root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=${base}/ubuntu-20.04-live-server-amd64.iso autoinstall ds=nocloud-net;s=http://ipxe.localdomain/ubuntuks.php?ip=${ip}&version=${UBUNTUVERSION}&doctype=20:48

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