/srv/irclogs.ubuntu.com/2017/11/16/#cloud-init.txt

SmokedCheesehello! it's possible to set hostname with variables?07:47
SmokedCheeseor should i use something like bootcmd: - hostnamectl set-hostname "hostname-$(http://169.254.169.254/2009-04-04/meta-data/instance-id)" ?07:58
smoserSmokedCheese: its not possible right now.  we have a card to do something like that.12:53
smoserso yeah, your only option is what you have there.12:53
SmokedCheeseokay, thanks!12:53
smoserSmokedCheese: https://trello.com/c/AYaCdQyT14:15
smoserthat is the card that describes what we'd be looking to do.14:15
smoserand i just added a section for what i think you were asking for.14:17
SmokedCheesesweet14:30
smoserpowersj: so... https://code.launchpad.net/~ajorgens/cloud-init/+git/cloud-init/+merge/33166016:14
smoserci didnt run. but didnt complaon16:14
smoserand /me didn't see it cry16:14
smoserbecause ajorgens isnt in happy list16:14
smoserprobably need some solution for that16:14
powersjaah16:14
powersjlet me add him to the white list16:15
blackboxsw+1 powersj can you make sure robjo is on that too16:15
blackboxswhe might already be16:15
powersjblackboxsw: robojo is rjschwei?16:16
blackboxswpowersj: yep16:16
smoserpowersj: where is that list ?16:16
powersjsmoser: torkoal:~/.jlp/jlp.config16:17
powersjand done16:18
robjomy lp userid is rjschwei16:26
robjopowersj: ^^^^16:26
powersjrobjo: thx16:27
blackboxswwelcome to the wide world of automated CI votes on your branches robjo17:35
robjoblackboxsw: thanks, something new to figure out ;)17:36
robjoon that note, anyone have any time to provide some feedback on the chrony integration on the ML?17:37
smoserblackboxsw: hm..17:39
smoserhm..17:40
blackboxswhm..17:40
blackboxswok cloud-init status systemctl checks is pushed18:18
blackboxswsorry smoser yeah that last paragraph of the blog post was WIP. will ping when done18:19
blackboxswok done.18:36
robjosmoser: blackboxsw was there a network rendering fix after 17.1 was released?19:18
robjoreference is https://bugzilla.opensuse.org/show_bug.cgi?id=106485419:18
ubot5bugzilla.opensuse.org bug 1064854 in OpenStack "cloud-init ignores network settings from config-drive in external network" [Normal,New]19:18
robjoit looks to me as if a V1 config is not properly transformed19:18
blackboxswrobjo approve https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/333575 with comments19:19
blackboxswapproved rather. nothing for you to fix that I can see.19:19
blackboxswprobably will merge later today19:19
blackboxswchecking the bug19:19
robjothis appears to be tested in test_apply_network_config_eni_ub in test_netconfig19:19
robjoand I fail to see where this transformation would be distro implementation dependent19:20
robjoThe way I see it the transformation should be as follows from V1 config to the debian/ubuntu network specification, which should then end up in the distro implementation which for openSUSE is still _write_network19:22
blackboxswrobjo: looks there is a distro-dependent component for network renders. I see renderer_configs defined in cloudinit/distros/debian.py which direct what renders to use for debian/ubntu19:30
blackboxswchecking how that's used19:31
robjoI am not using the renderer concept yet, because the sysconfig renderer has the path hard coded and the paths between RH and SUSE do not match, that's where the refactoring comes into play that I mentioned in the meeting the other day19:32
robjofor now I end up in network_state.parse_net_config_data19:33
robjoIn "regular" code flow somewhere would be a call to distro,apply_network_config(), which fails for openSUSE/SLES the exception is then caught and we end up in _apply_network_from_network_config19:34
robjoin this method the information is supposed to be transformed to the "standard" debian/ubuntu interface configuration, i.e. it should look something like V1_NET_CFG_OUTPUT in the test19:35
robjois there a test that covers that specific transformation?19:36
rharperrobjo: so, network_data.json -> v1 config  happens, then, since you're not yet using the sysconfig renderer,  you're getting an already rendered eni config, but the opensuse write_network is re-reading it to convert it to sysconfig; it appears19:42
blackboxswgenerally there is ./tools/net-convert in our repository we use to validate rendering types given a provided network config and specifying whether your are rendering ['eni', 'netplan', 'sysconfig'] output files.19:42
rharperI don't think we have a v1 -> net_util.translate_network() path19:42
rharperwhich is what's happening here19:42
rharperrobjo: and there are no unit tests for net_util19:44
robjo:(19:44
blackboxswmeh the problem with 63% unittest coverage, is the other 37%19:45
rharperwhats the delta in rhel sysconfig paths and suse ones?19:47
rharperthat seems like a shorter path (using sysconfig renderer in the suse distro class)19:47
robjo'network' (SUSE) vs. 'network-scripts' (RHEL) , yes I also roll my eyes over stuff like this ;)19:48
rharperman, that wants some temporary symlinking19:48
rharperif that's it19:48
robjowell "two ugly" do not really make "one pretty"19:49
rharpernope19:49
rharperbut the instance boots with networking19:49
rharpertoo bad we can't ask sysconfig what paths it's using19:50
robjobut I suppose I could force the symlink in the cloud-init package, although I I remember correctly I tried to patch the path for 0.7.9 and that failed19:51
rharperrobjo: where duse SUSE put the /etc/sysconfig/network (global settings) file ?19:51
robjoof course when 17.1 came around I had forgotten all of that and just moved forward since a good chunk of my out of tree code was now included19:52
rharperon RH, that has NETWORKING=yes and NETWORKING_IPV6=yes ;19:52
robjothe global settings file is /etc/sysconfig/network/config19:52
rharperurg19:53
rharperso both those paths19:53
robjoI suppose in the rendered we could test the and then switch between 'network' and 'network-scripts' but that's not very pretty either19:53
robjos/rendered/renderer/19:54
rharperwell, I was thinking about that as well but; I think there may be other issues19:54
rharperin that config file, it uses NETCONFIG_* namespace for some variables19:54
rharperI suspect you'd need a subclass of sysconfig for some things, but others would be fine19:55
rharperbbiab19:56
robjoyes, there are NETCONFIG_* settings in that file19:56
robjoI agree that the proper route is subclassing i.e. refactoring, hence my question during the meeting19:57
robjoI think the shorter path for now may be to figure out a v1 -> net_util.translate_network()19:58
robjounfortunately I am getting lost in network_state.py in parse_config_v1, cannot quite wrap my head around what's happening there19:58
robjoBTW at least in the code the path from v1 -> net_util.translate_network() at the high level is not too convoluted20:04
robjoIf I put he puzzle together properly it would go along these lines:20:05
robjoapply_network_config -> this raises an exception which is caught and gets me to _apply_network_from_network_config here the config gets transformed vi network_state.parse_net_config_data() and eni.network_state_to_eni() then we end up in apply_network which finally calls _write_network() and the last method is implemented in the distro subclass and for openSUSE/SLES we end up caling net_util.translate_network()20:08
robjomy thinking is that either in network_state.parse_net_config_data() or eni.network_state_to_eni() something goes wrong20:09
smoserblackboxsw: were you looking at centos fail ?20:29
smoseri verified it does fail here locally20:31
smoser ./tools/run-centos --unittest 7 --keep20:31
blackboxswsmoser: yeah I had forgotten while fixing up disable and the blogpost. but reproduced on 6 and I'm working now20:33
blackboxswlooks like the URLError text raised is different in centos than ubuntu: 403 Client Error: Forbidden for url: %s versus just "403 Client Error: Forbidden"20:41
ubot5Error: Ubuntu bug 403 could not be found20:41
blackboxswthx ubot520:41
blackboxswI'll update a patch to provide the bad_url if not present in the error message20:42
smosernacc: i think you told me of somethign that is like20:43
smoser git commit-tree && HEAD20:43
smoserie, head after commit-tree20:43
smoser?20:43
naccsmoser: sorry, not followinng20:45
smoserif i have changes in my working directory20:46
smoseri wanted to refer to HEAD + changes-to-tracked files20:46
smoserithink like this https://stackoverflow.com/questions/2766600/git-archive-of-repository-with-uncommitted-changes20:47
naccsmoser: you can write-tree20:47
naccsmoser: and that gives you a treeish20:47
naccand git-archive can archive a treeish20:47
naccsmoser: it depends on what you want to do ... HEAD points to a commit, so it can't point to an uncommited state20:47
smoserand the yes20:47
naccsmoser: is there any reason you ca't just do a wip commit?20:48
nacc(which you might discard later)20:48
smoserhow do you you reset to state before the commit ?20:49
smoserincluding 'git add' or other things.20:50
smoserie, if i20:51
smoser touch foo20:51
smoser git add foo20:51
smoser git commit -a -m "that wip commit"20:52
smoser git reset HEAD^20:52
naccsmoser: you can alwasy reset --hard to a commit20:52
smoserthen i've lost the fact that 'foo' was added20:52
naccsmoser: and potentially do a `git clean -fxd`20:52
naccsmoser: no, it's still inn the commit you created20:52
smoseryeah, but the state of having been added is lost20:52
naccsmoser: i mean, i'm not sure i understand the use case, exactly20:52
smoserexcept for in that commit20:52
naccsmoser: oh you want to go back to an index state?20:55
smoseryeah, that was the goal.20:57
smoserbasically i wanted to collect the tree up as it is right now.20:57
smoserwierd, i looked at 'git stash create'20:57
smoserthis seems wrong:20:57
smoser echo "hi mom" > foo.txt20:57
smoser git add foo.txt20:57
smoser git stash create20:57
smoserthe stash does not contain the new 'foo.txt'20:57
smoseroh wait. it does20:58
blackboxswpowersj: smoser https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/333845 for the ci nightly errors21:00
rharperrobjo: re v1 -> translate; I think at least for the immediate concern, matching the post-up "default gw" -> gateway: <value>  ought to get that working21:01
naccsmoser: i'm still trying to understad why you want the tree up to now? for a git-archive call?21:01
robjorharper: ?21:02
rharperrobjo: by my reading it goes config-drive -> openstack helper convert_network_data_json to v1 config -> v1 config gets rendered to eni, then the eni content get's passed to your class which calls net_util.translate()21:02
robjoOK, then I am on a wild goose chase21:03
rharperyes, the https://bugzilla.opensuse.org/attachment.cgi?id=74902621:04
rharpershows the 2017-11-16 15:26:39,868 - opensuse.py[DEBUG]: Translated ubuntu style network settings # Converted from network_config for distro <class 'cloudinit.distros.opensuse.Distro'21:04
rharperand then prints out the eni that got converted from v1 config21:04
rharperin distro base-class, it emits the Warning, thand then does a ns = network_state_parse_config(which is fed the v1 which was converted from the network-data json, you can see the v1 config earlyer in the log)21:05
rharperthen in base distro, it does content = eni.network_state_to_eni() which makes an eni file; and passes that to the distro specify layer (self.apply_network() -> self._write_network())21:06
robjoI am confused about where the openstack helper comes into play21:06
rharperconverting the config drive network_data.json21:06
rharperwhen the Datasource is parsing it's input21:06
rharperrobjo: cloud-init local runs to find the datasource, detects config-drive and runs the ConfigDrive datasource; in it, if there is a file network_data.json, it calls the helper to convert the json into v1 config and storages it in DataSource class property (network-config);  then as cloud-init local continues, if the datasource has a 'network-config' property; it it's read and "rendered"21:10
rharper2017-11-16 15:26:39,825 - stages.py[DEBUG]: applying net config names for {'version': 1, 'config': [{'subnets': [{u'routes': [{u'netmask': u'0.0.0.0', u'network': u'0.0.0.0', u'gateway': u'192.168.168.1'}], u'netmask': u'255.255.255.0', u'type': 'static', 'ipv4': True, 'address': u'192.168.168.30'}], 'mac_address': u'fa:16:3e:ee:2b:97', u'type': 'physical', 'name': 'eth0', u'mtu': 1500}]}21:10
rharperthere you can see stages applying the v1 config that it got from the configdrive data source (after the network_data.json conversion)21:10
robjoyes, that very early part I ignored and I started with that data and where I think it would end up in the code21:11
naccsmoser: sorry for being dense if i'm missing something obvious21:11
robjoand as I noted in comment #32 in the bug gateway information is missing from the renedered intermediate format21:12
rharperright, that;s due to hoe the eni is rendered21:14
rharperthe gateway is inside the post-up route add default gw <gatewayip>21:14
rharperthe net_util.translate does not know how to (yet) extract the gateway value from the eni contents21:14
rharperso, I believe in that net_util.translate, you can check if line has 'post-up' and 'default gw' strings21:15
rharperand extract out the ip addr in there and use that as the GATEWAY= value in sysconfig21:15
rharperyou can see the v1 dictionary has 'gateway': 192.168.168.1 which matches the post-up line; post-up route add default gw 192.168.168.1 || true21:16
robjoOK I think I think I get how that part of the puzzle fits together21:18
rharperthe network_data.json file may have other routes that are not default gateway ones, so there may be additional {pre,post}-{up,down} routes added which will also need converting to the sysconfig syntax; depending on how far you want to take the translator21:23
robjowell everything that is not "default gw" shoud really go into ifroute-IFACE21:26
rharperyes, I think so21:28
rharperwe generally only had special handling for default gw, vs. route add -net21:28

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