Merge lp:~smoser/simplestreams/trunk.fix-bionic-tools into lp:simplestreams

Proposed by Scott Moser
Status: Merged
Merged at revision: 458
Proposed branch: lp:~smoser/simplestreams/trunk.fix-bionic-tools
Merge into: lp:simplestreams
Diff against target: 25 lines (+12/-3)
1 file modified
tools/ubuntu_versions.py (+12/-3)
To merge this branch: bzr merge lp:~smoser/simplestreams/trunk.fix-bionic-tools
Reviewer Review Type Date Requested Status
Dan Watkins (community) Approve
Server Team CI bot continuous-integration Approve
simplestreams-dev Pending
Review via email: mp+337892@code.launchpad.net

Commit message

Fix ubuntu_versions.py with distro_info > 0.14.

The 'hack_all' nature of 'hack_all' variable name showed itself.
We had been accessing '_rows'. That is now '_releases' and
the content there is no longer a dictionary but rather a
DistroRelease object.

The reason we have to do this at all is to get at the datetime
object for 'eol'. Without that, all we can do is provide a date
and check if a release is supported as of that date. What we want
is to publish the EOL date (in YYYY-MM-DD format).

This change was present in distro_info at 0.15. Artful had 0.17,
bionic has 0.18. Apparently we just didn't notice until now.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
458. By Scott Moser

merge from trunk

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Dan Watkins (oddbloke) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/ubuntu_versions.py'
2--- tools/ubuntu_versions.py 2017-04-25 19:43:47 +0000
3+++ tools/ubuntu_versions.py 2018-02-16 19:19:17 +0000
4@@ -105,9 +105,18 @@
5 ret = []
6
7 # hack_all, because we're using '_rows', which is not supported
8- # however it is the only real way to get at EOL, and is convenient
9- # series there is codename to us
10- hack_all = {i['series']: i for i in udi._rows}
11+ # however it is the only real way to get at EOL, which we need.
12+ # 'series' there is our 'codename'
13+ if hasattr(udi, '_rows'):
14+ hack_all = {i['series']: i for i in udi._rows}
15+ else:
16+ # in bionic versions of distro-info, _rows was replaced with
17+ # _releases which is a DistroRelease object rather than a dictionary.
18+ fields = ('version', 'codename', 'series', 'created', 'release',
19+ 'eol', 'eol_server')
20+ hack_all = {drel.series: {k: getattr(drel, k) for k in fields}
21+ for drel in udi._releases}
22+
23 for i, codename in enumerate(codenames):
24 title = "%s LTS" % versions[i] if lts[i] else versions[i]
25 eol = hack_all[codename]['eol'].strftime("%Y-%m-%d")

Subscribers

People subscribed via source and target branches

to all changes: