Merge ~jslarraz/ubuntu-qa-tools:fix-find-latest-release into ubuntu-qa-tools:master

Proposed by Jorge Sancho Larraz
Status: Merged
Merged at revision: 2cd04846db11028244d11e85ea3ca739941d3cdf
Proposed branch: ~jslarraz/ubuntu-qa-tools:fix-find-latest-release
Merge into: ubuntu-qa-tools:master
Diff against target: 18 lines (+1/-6)
1 file modified
vm-tools/uvt (+1/-6)
Reviewer Review Type Date Requested Status
Marc Deslauriers Approve
Review via email: mp+460676@code.launchpad.net

Commit message

uvt: fix find_latest_release

Description of the change

find_latest_release seems to stop working properly for some releases. For trusty it returns just 14.04 what leads to an error in the iso download. This MR fixes it

To post a comment you must log in.
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Yep, looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/vm-tools/uvt b/vm-tools/uvt
2index c7b0143..fca876d 100755
3--- a/vm-tools/uvt
4+++ b/vm-tools/uvt
5@@ -2959,12 +2959,7 @@ def find_latest_release(release_num, iso_type):
6 print("Could not reach web server! Please download manually.")
7 sys.exit(1)
8
9- text = re.compile(r'<[^>]+>').sub('', html).split('\n')
10- matches = []
11- for line in text:
12- if line.startswith(' ' + release_num):
13- matches.append(re.search(r'(\d+\.\d+(\.\d+)?)\/', line).group(1))
14-
15+ matches = re.findall(re.escape(release_num) + "\.\d+", html)
16 if len(matches) > 0:
17 latest_release = sorted(matches)[-1]
18 print("Found release %s" % latest_release)

Subscribers

People subscribed via source and target branches