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

=== Wulf4 is now known as Wulf
=== blaisebool is now known as Guest46113
WulfI'm running AWS EC2 instances. I would like to pass a parametrized URL as userdata like "#include http://path/foo?a=b&c=d". foo should contain python code (same for all instances) that will be executed by cloud-init and dynamically create a cloud-config configuration and inject it into cloud-init. I kind of got it working with a part-handler and sys._getframe, but it's really ugly. Is there (or should16:21
Wulfthere be) any proper way to achieve the same?16:21
smoserWulf, you're wanting the instance to identify itself in the '#include' i guess ?16:26
smosersomehow ?16:26
smoser(headers would be an option)16:26
Wulfsmoser: no, the web server is static (e.g. s3), so the client (cloud-init) won't identify itself16:27
Wulfsmoser: but the url might contain like ?name=newhostname16:27
smoseri guess you overrode the part-handler for '#include' ?16:28
smoserwhat you're asking for does sound interesting16:28
Wulfsmoser: no, for a new mime type16:28
WulfSo is there currently any other way to download+execute arbitrary code than a part-handler?16:42
smoserwell, a '#!'16:43
smoserWulf, but that has the same general issue ... i think you're wanting python access to hostname or instanceid ... is that right ?16:44
smoseris that what you were using sys._getframe for ?16:44
Wulfsmoser: I want python access to the cloud-config part so I can set the hostname of a list off ssh keys, host specific mounts, etc. I use sys._getframe to access walker_callback.data['handlers']['text/cloud-config']16:46
Wulf*or a list of ssh...*16:47
smoserso i think i udnerstand, but i'm kind of confused.16:49
smoseris the url static for each node ?16:51
smoserie, you want static url and static content16:51
smoserthat produces different cloud-config for the node based on information available on the node.16:52
Wulfsmoser: the content is static, the url might vary with ?parameter=value which the webserver behind it ignores16:52
smoseri think16:52
smoserpowersj, do you know why the copr build failures ?17:14
powersjsmoser: I looked briefly friday and it appears that the lxd pull is failing17:15
powersjlxd file pull*17:15
powersjsays the file does not exist; I didn't have enough time to determine if it was due to the lxd 2.15 update, but that is the only thing to have changed17:16
=== blackboxsw_away is now known as blackboxsw
powersjblackboxsw: \o/17:23
blackboxswpowersj: and smoser you guys are around an awful lot for vacationing ;)17:27
smoserblackboxsw, i'm officiall in today17:27
blackboxswohh didn't realize that.17:27
* powersj isn't, but broken AC means I'm sitting at coffee shop17:27
smoserpowersj, has no excuse.17:27
smoserblackboxsw, i'm out the rest of the week thoguh17:28
smoserblackboxsw, if you were just bored...18:08
smoser2 things18:09
smosera.) when i run: tox-venv py3 python3 -m nose tests/unittests/18:09
smoser  tests.unittests.test_datasource.test_openstack.TestOpenStackDataSource is the slowest.18:09
smoserb.) i believe if you launch an openstack instance without user-data then it will re-try to get it (if its not been given it will 404)18:10
smoserand we should accept that as "no user data", rather than trying again18:10
smoser(i think these 2 things might be related)18:11
blackboxswroger smoser18:12
blackboxswok so we want the code to avoid retries on 404?18:12
smoserfor user-data specifically18:13
blackboxswhmm I already see MetadataReader.should_retry_cb in cloudinit/sources/helpers/openstack.py which should return False if error code >= 40018:25
smoserblackboxsw, ssh ubuntu@10.245.162.12018:34
smoseri think you should be able to get there (with vpn)18:34
smoser  /var/log/cloud-init.log -> http://paste.ubuntu.com/25012904/18:34
blackboxswI'm there18:34
smoser2017-07-03 18:26:51,445 - url_helper.py[DEBUG]: [0/6] open 'http://169.254.169.254/openstack/latest/user_data' with {'timeout': 10.0, 'method': 'GET', 'allow_redirects': True, 'headers': {'User-Agent': 'Cloud-Init/0.7.9'}, 'url': 'http://169.254.169.254/openstack/latest/user_data'} configuration18:35
smoser2017-07-03 18:26:52,514 - url_helper.py[DEBUG]: Please wait 1 seconds while we wait to try again18:35
blackboxswheh, well that looks like it's not using that retry logic I saw for the base metadata crawler. ok thx.18:35
blackboxswlooks like it hit that retry about 5 times/18:36
blackboxswok18:36
smoserright18:36
blackboxswok I exited your instance18:37
blackboxswok it's the wait _for_url  call18:38
blackboxswgot it.18:38
blackboxswsure I'll pull together a fix18:38
=== MrWatson is now known as NostawRm
smoserblackboxsw, file a bug please too18:45
smoserand thank you18:45
blackboxswno prob18:45
blackboxswsmoser: vendordata and networkdata (both are optional metadata, shall we also avoid retries in those cases?)19:13
smoseri think those work as expected.19:13
smoseri think.19:13
smoseri think they're both guaranteed19:14
blackboxswok I was just trying to queue off of the commonolity of networkdata and vendordata also being listed as optional in cloudinit/sources/helpers/openstack.py 227-24119:16
blackboxswcommonality rather19:17
blackboxswas in, if optional: don't retry 40419:17
blackboxswbut we can make it specific to just user_data if we want19:17
smoserblackboxsw, they may be optional. i was just going from memory19:23
smoseryou can look in https://github.com/openstack/nova/blob/master/nova/api/metadata/base.py#L44919:24
smoserthats the backend19:24
blackboxswIf I'm reading things right, looks like network_data is avail on Liberty, but not on other versions. Vendor data is available on Havana, but Vendor-data2 is avail on Newton2. So they too look optional.19:58
blackboxswdepending on the version of openstack19:58
blackboxswhttps://github.com/openstack/nova/blob/master/nova/api/metadata/base.py#L62719:59
blackboxswahh that _check_os_version call is that the version is >= <version_name> so    vendor_data exists >= Havana, network_data exists >= Liberty20:03
blackboxswdoes cloud-init need to support < Havana?20:03
smoseri didnt know there is a vendor-data2.20:05
smoserblackboxsw, https://releases.openstack.org/20:07
smoseri'd say we can get away with breaking support for a platform that has been EOL for 2.5 years.20:08
smoseri guess the realistic scenario would be someone running 12.04 but wanted to run 16.04 guests... we'd break them.20:08
blackboxswheh, didn't know if cloud-init had compelling customer base running on pre-Havana (I'd think any vendor running on that version of openstack would have moved to something a bit more recent anyway)20:09
blackboxswgotta head out for the day22:57

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