/srv/irclogs.ubuntu.com/2018/07/06/#cloud-init.txt

=== medberry is now known as Guest62131
danMSblackboxsw: i uploaded the collect-logs output for 1779207, lmk if you need anything else?18:23
blackboxswthanks danMS !19:32
blackboxswoops rharper: $ lxc exec test-xenial -- python3 -c 'from platform import dist; from cloudinit.util import get_linux_distro; print(dist()); print(get_linux_distro())'19:32
blackboxsw('Ubuntu', '16.04', 'xenial')19:32
blackboxsw('ubuntu', '16.04', 'x86_64')19:32
blackboxswso cloud-init's new get_linux_distro is actually returning arch instead of series19:32
rharpereww19:32
rharperhow do we not have unittest for that ?19:32
blackboxswI think it's all mocked, but checking now19:33
rharperthere's no reason for a mock19:33
rharperat least not under the util path19:33
rharpercertainly for distro objects19:33
* blackboxsw wonders what the impact would have been here. (and why it didn't show up as a problem)19:33
rharperbut unittesting get_linux_distro shouldn't ; we could mock the read() results from parsing what os-release looks like19:33
rharperwe only use release in one place19:34
rharperunder ntp for ubuntu19:34
rharpergenerally, getting 'ubuntu' vs. 'redhat' is the variant that we key on19:34
rharperpossible the opensusu/sles stuff for ntp could fail as well though I suspect the code works fine with the os-release in opensuse19:34
blackboxswhrm all unit tests were using platform.machine() as the third entry in the tuple19:35
rharperwhich gives me x86_6419:35
rharperon my xenial machine19:35
blackboxswwhich made an incorrect assumption about the orig output of platform.dist()19:35
blackboxswyeah, that's a valid return, but platform.dist() on your system reports series as 3rd element19:36
rharperyes19:36
rharperplatform.dist()19:36
rharper('centos', '7.4.1708', 'Core')19:36
rharperthat's even stranger19:36
rharperah, that's its code name19:36
* blackboxsw checks sles19:37
rharperhrm, machine just looks wrong; not sure why we didn't catch that19:38
blackboxswhrm ('SuSE', '42.3', 'x86_64')19:39
blackboxswon suse that is what it returns19:39
rharperright, that path looks like it's not expected to be taken19:39
rharperhow do you get that path anyhow ?19:40
rharperoh I see, parsing os-release path19:40
blackboxswsorry not following. right, we process /etc/os-release19:40
rharperI see it now; it's like we're missing the last tuple being read out of os-release19:40
rharperin Xenial, it should be VERSION_CODENAME19:41
rharperand there is no such field in redhat/centos19:41
rharperyuck, so in centos/redhat PRETTY_NAME includes the codename, but ubuntu's PRETTY_NAME has Ubuntu 16.04 LTS19:44
rharperso no single entry works to pick out element 3 of the platform.dist() tuple19:45
blackboxswfrom sles https://pastebin.ubuntu.com/p/q89fsmwBVD/19:45
rharperI wonder if they have a codename19:46
blackboxswyeah I'm filing a bug, SRU-blocker :/19:48
blackboxswrharper: system_info()['dist'] series is used by cloudinit/distros/ubuntu.py for ntp client choices19:49
blackboxswso it'll break on xenial19:49
blackboxswcoding up a fix :/19:49
blackboxswweird behavior on sles.19:50
blackboxswplatform.machine instead of codename or series19:50
blackboxswit was my original review on that branch. I should've noted it :/19:51
rharperblackboxsw: yeah =(19:57
rharperI think bringing in the major distro os-release files into the unittest to verify we pull out the bits we want is going to be needed19:58
blackboxswyeah can add that in this pass19:59
blackboxswthank lxc for ease of testing these envs19:59
rharperthe ci tests with different distros could (should) verify we get what we want out of /etc/os-release ?19:59
rharperyeah19:59
blackboxswok filed https://bugs.launchpad.net/cloud-init/+bug/178048120:08
ubot5Ubuntu bug 1780481 in cloud-init "ubuntu/centos/debian: get_linux_distro has different behavior than platform.dist" [Undecided,New]20:08
blackboxswhrm rharper robjo this also won't work exactly as it currently does on opensuse 42.3,20:14
blackboxswsles42:~ # python3 -c 'from platform import dist; print(dist());'20:14
blackboxsw('SuSE', '42.3', 'x86_64')20:14
blackboxswbut per /etc/os/release: ID=opensuse20:14
rharper=(20:15
blackboxswso cloudinit.util.get_linux_distro would return ('opensuse',...) instead of SuSE20:15
rharpershoudl we back this out?20:15
rharperwe've not crossed the EOL for platform.dist() yet20:15
rharperblackboxsw: we're both out next week, but smoser is back20:15
blackboxswI think it's worth backing it out as it doesn't seem to work on all release of any given distribution20:15
robjoin opensuse 42.3 cloud-init runs with python 2 and because .dist works the os-release is not read, or should not be read20:16
robjobacking it out will break SLES 15 which will be released on monday and is way more important to us than openSUSE20:17
robjoI am pretty certain I tested on openSUSE and things worked as expected20:17
blackboxsw robjo I thought the get_linux_distro code sources /etc/os-release as primary option if file exists20:17
robjolet me double check20:17
rharperrobjo: do you have a sles15 os-release handy while you're looking ?20:18
rharperwhile we're triaging the bug blackboxsw filed, best to collect as much details so we can see how best to sort it out;20:18
rharperrobjo: we certainly don't want to break any distro20:18
blackboxswrobjo: trying to validate now20:18
blackboxswsles42:~ # python -c 'from cloudinit.util import get_linux_distro; from platform import dist; print(dist()); print(get_linux_distro())'20:19
blackboxsw('SuSE', '42.3', 'x86_64')20:19
blackboxsw('opensuse', '42.3', 'x86_64')20:19
blackboxswso here's the diff on opensuse 42.320:19
blackboxswit's like we need a mapping from ID -> python_dist_value20:19
robjobut this is used for variant definition and I handled all cases and added opensuse as needed20:21
robjowhy is this popping up?20:21
rharperprocessing os-release on xenial results i getting x86_64 and no variant20:22
rharpercentos is the same20:23
rharperplatform.dist() tuple returns the 'codename'  of the release20:23
blackboxswyeah, surfacing just platform.machine() in all distros doesn't match platform.dist() output :/20:24
robjoso os-release on xenial does not confirm to the freedesktop.org format of os-release?20:24
robjos/confirm/conform/20:25
* blackboxsw tries to find a spec on that. I don't think it's /etc/os-release related that's the problem, it's platform.dist() reporting different content on different distros20:25
rharperreading os-release means that the third tuple is platform.machine()20:26
rharperthat doesn't match on centos nor on ubuntu20:26
rharper platform.dist()20:26
rharper('centos', '7.4.1708', 'Core')20:26
rharperplatform.dist()20:26
rharper('Ubuntu', '16.04', 'xenial')20:26
blackboxswon sles-based it seems platform.machine() as the 3rd element is reasonable. but centos/rhel/ubuntu/debian it breaks conformance as 3rd element is series20:26
blackboxswseries/flavor/codename20:26
rharperwe don't use the variant much, but at least in the ntp path on Xenial, we are using it there20:27
blackboxswyeah that's the only place in cloudinit that it is being used20:27
rharperI wonder why python on sles returns the machine ?20:27
rharperor why ubuntu and redhat/centos return the codename ?20:28
blackboxswand why on opensuse it return 'SuSE' instead (which also isn't represented in /etc/os-release)20:28
robjotouche sample size of one :(, so platform.machine() needs to be replaced by whatever returns the flavor, I think that would be codename in os-release20:28
rharperyes20:28
rharperbut20:28
rharperCODENAME is not present in all os-releases =(20:28
rharperwhat a PITA20:28
rharperthe 'Core' in os-release in centos/redhat is part of the VERSION_ID but the value CODENAME is not set20:29
blackboxswand Core for centos' os-release would work for debian20:30
blackboxswPRETTY_NAME="Debian GNU/Linux 9 (stretch)"20:30
blackboxswmatch the (<codename>) re20:30
rharperyeah, but we should try to get as many of these20:30
blackboxswbut codename doesn't matter for debian.... root@debStretch:~# python -c 'from platform import dist; print(dist());'20:31
blackboxsw('debian', '9.4', '')20:31
rharperrolling our own sorta hurts here20:31
rharperlol20:31
blackboxswyeah I think I can draw up a fairly simple fixup if we need to keep this changeset in. At least it should get us through on debian/ubuntu/centos....20:31
rharperwe should get an os-release of SLES 15 from robjo if we can20:32
blackboxswsince robjo doesn't get affected by ('opensuse',...) instead of 'SuSE' we probably don't need a distro-release-lookup map to sort those differences20:32
rharperand the python2/python3 platform.dist() output as well20:32
rharperjust for completeness sake20:32
blackboxsw+1 robjo if possible. I know you included snippets in unit tests20:32
blackboxswin cloudinit/tests/test_util.py20:33
blackboxswI can add an opensuse42.3  one too as I have that on hand20:33
blackboxswthen at least we document existing behavior and only resolve the mapping opensuse -> SuSE if need be20:34
robjo# cat /etc/os-release20:34
robjoNAME="SLES"20:34
robjoVERSION="15"20:34
robjoVERSION_ID="15"20:34
robjoPRETTY_NAME="SUSE Linux Enterprise Server 15"20:34
robjoID="sles"20:35
robjoID_LIKE="suse"20:35
robjoANSI_COLOR="0;32"20:35
robjoCPE_NAME="cpe:/o:suse:sles:15"20:35
robjoSO we could do "if codename in os-release -> use it, else platform.machine()" that is is xenial sets codename ;)20:35
rharperrobjo: yes, that sounds right20:45
robjoblackboxsw: rharper one of you handling this or you want me to?20:47
blackboxswrobjo: on it no worries I'll assign you as a reviewer on the brnach20:48
robjoI will not get to it until Monday, in the middle of pushing out EC2 images20:48
blackboxsw+1 robjo20:48
robjoOK, cool thanks20:48
blackboxswno worries20:48
blackboxswrobjo: rharper branch pushed a branch for review whenever https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/34908121:25
blackboxswI'll block cloud-init's SRU on this21:25

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