← Back to team overview

ubuntu-bugcontrol team mailing list archive

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

 

Jorge Sancho Larraz has proposed merging ~jslarraz/ubuntu-qa-tools:fix-find-latest-release into ubuntu-qa-tools:master.

Commit message:
uvt: fix find_latest_release

Requested reviews:
  Ubuntu Bug Control (ubuntu-bugcontrol)

For more details, see:
https://code.launchpad.net/~jslarraz/ubuntu-qa-tools/+git/ubuntu-qa-tools/+merge/460676

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 
-- 
Your team Ubuntu Bug Control is requested to review the proposed merge of ~jslarraz/ubuntu-qa-tools:fix-find-latest-release into ubuntu-qa-tools:master.
diff --git a/vm-tools/uvt b/vm-tools/uvt
index c7b0143..fca876d 100755
--- a/vm-tools/uvt
+++ b/vm-tools/uvt
@@ -2959,12 +2959,7 @@ def find_latest_release(release_num, iso_type):
         print("Could not reach web server! Please download manually.")
         sys.exit(1)
 
-    text = re.compile(r'<[^>]+>').sub('', html).split('\n')
-    matches = []
-    for line in text:
-        if line.startswith(' ' + release_num):
-            matches.append(re.search(r'(\d+\.\d+(\.\d+)?)\/', line).group(1))
-
+    matches = re.findall(re.escape(release_num) + "\.\d+", html)
     if len(matches) > 0:
         latest_release = sorted(matches)[-1]
         print("Found release %s" % latest_release)

Follow ups