[00:19] hey how does that hostname thing work? [00:22] so usually datasources provide metadata and read it in [00:22] and all these modules get activated, they get passed the data from config and metadata and all that [00:22] and then they just use it to do whatever the module wants to do [00:23] in this case it calls into a distro specific object (since setting the hostname is distro dependent) and sets it [00:24] harlowja: so.... it doesn't actually set the hostname? [00:24] the module has access to this distrobution specific object, it asks that object to set the hostname [00:24] cuz... the hostname format is a highly specific thing isn't it? [00:24] not the hostname format [00:24] the way to set it seems to be [00:24] different in freebsd, ubuntu, rhel [00:25] rhel has a /etc/syconfig file [00:25] ubuntu has a different one [00:25] lemme try a different angle... where does it get the source of the hostname? [00:25] from the datasource [00:25] http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/cloudinit/sources/__init__.py#L164 [00:26] the datasource gets it from some location [00:26] *datasource specific [00:26] which u would think in the GCE datasource would be there metadata server [00:26] yes, but where in the data source? what key? [00:26] see above function [00:27] basically datasources when they fetch there data populate self.metadata [00:27] 'local-hostname' ? [00:27] is this stuff documented somewhere? [00:27] how would I have known it's local-hostname and not hostname? [00:29] man I am confused [00:29] http://cloudinit.readthedocs.org/en/latest/topics/modules.html .... nothing. No modules. [00:30] for that matter, if GCE is in the latest version of cloudinit, where is it documented? There's no mention of it at http://cloudinit.readthedocs.org/en/latest/topics/datasources.html [00:31] dgarstang1 its not in any cloud-init i know about, seems to have been a debian specific patch [00:31] so its not in the upstream cloud-init, so wouldn't be on cloudinit.readthedocs.org [00:31] harlowja: ok, how about docs on the set_hostname module? [00:31] probably not as good as it could be [00:32] http://cloudinit.readthedocs.org/en/latest/topics/datasources.html#ec2 ... 'Metadata is accessible via the following URL:'... how's that relevant? [00:32] isn't cloud-init supposed to abstract that so I can't see it and don't care? [00:33] I'd really liketo know how the set_hostname module works, like what key in the metadata it reas [00:33] python is pretty readible, so http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/cloudinit/sources/__init__.py#L164 sorta describes the whole process [00:34] ah the old read the code reply. :) [00:34] code always lacks context [00:35] like, if I am reading the code for cloudinit __init__, why does it have a get_hostname function there? wouldn't that be in the get_hostname module? Doesn't that mean it's in a different python file somewhere else? [00:37] dgarstang1 not really, there is a baseclass for datasources in __init__ [00:37] so maybe I need to read this source file, but ... wait... there's a module called update_hostname, which isn't here [00:37] the function is in this baseclass [00:37] right, modules != datasources [00:38] harlowja: so where's the code for set_hostname? [00:38] it isn't in 1 place, it begins its life in the update_hostname module [00:38] in that case, docs would be nice. :) [00:39] sure, i'd much appreciate them also, but not enough time in the day :) [00:39] or, we'll just keep doing what we are doing and hacking it, not fully using the features of cloud init, and reading the hostname from the metadata ourselves and setting it in a runcmd section [00:39] sure, or feel free to keep on asking questions and we can provide answers, and presto a doc that u can then submit ;) [00:40] harlowja: well, I dunno [00:40] i understand how this is not ideal, but it is what it is [00:40] I'd ask what metadata the hostname module uses, but I don't even know if that's specific to the data source, or a common attribute for all [00:40] prior to before i created http://cloudinit.readthedocs.org it wasn't any better, but a collection of small improvements in the end makes it better for everyone :) [00:41] dgarstang1 its specific to a datasource [00:41] since different datasource retrieve it differently [00:41] ok [00:42] so this then involves the question of what is the GCE thing doing (which i haven't seen the code for, since it never seems to have appeared upstream?) [00:42] So, ec2 ds doesn't even have a set_hostname http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/cloudinit/sources/DataSourceEc2.py [00:42] dgarstang1 right, thats what inheritence is for [00:42] in fact, it's got almost nothing [00:42] base class usually provide most of the functionality [00:43] ic [00:43] most datasources just provide def get_data(self): [00:43] which is there special way of reading [00:43] *which is the thing that varies [00:44] Ok, so there's no set_hostname in DataSource either... http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/cloudinit/sources/__init__.py [00:44] ah, my fault, thought u mean get_hostname [00:44] right, so datasources provide the data that other parts of cloud-init use [00:44] so it wouldn't make sense for a datasource to set anything [00:45] well, the default cloud_init_modules has set_hostname, amongst oters [00:45] yes, modules (one of those is set_hostname) != datasourcs [00:45] it doesnt make sense for a data source to set anything? who does? [00:45] the set_hostname module? where's the code for that? [00:45] http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/cloudinit/config/cc_set_hostname.py [00:46] well that doesn't tell me what metadata it wants to use. [00:46] ugh [00:47] util.get_hostname_fqdn [00:48] still not seeing it, sorry [00:48] which itself will eventually call into the datasource get_hostname [00:49] so set_hostname calls first util.get_hostname_fqdn which eventually calls into datasource get_hostname (the base class) [00:49] so that tells u where it comes from [00:49] the base class then looks in a few places [00:49] http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/cloudinit/sources/__init__.py#L164 [00:49] lhost = self.metadata['local-hostname'] [00:49] line 186 [00:50] then that module asks the distrobution specific object to set the hostname to this value [00:50] which will then do whatever distribution specific thing to set the hostname [00:51] self.metadata is populated by however the datasource fetches its data (which in your case would be whatever the gce datasource is doing) [00:51] kk, thanks [00:52] np [00:52] so in the end it becomes a question what is the GCE datasource doing :) [00:52] and since i'm not sure where that code is, hard to know :-P === harlowja is now known as harlowja_away