Merge ~georgiag/ubuntu-qa-tools:devel-iso into ubuntu-qa-tools:master

Proposed by Georgia Garcia
Status: Needs review
Proposed branch: ~georgiag/ubuntu-qa-tools:devel-iso
Merge into: ubuntu-qa-tools:master
Diff against target: 57 lines (+29/-3)
1 file modified
vm-tools/uvt (+29/-3)
Reviewer Review Type Date Requested Status
Ubuntu Bug Control Pending
Review via email: mp+457557@code.launchpad.net
To post a comment you must log in.

Unmerged commits

a0a5ca7... by Georgia Garcia

uvt: download iso from development release

Signed-off-by: Georgia Garcia <email address hidden>

1520a0d... by Georgia Garcia

uvt: ignore prefix when name is specified

The original intent was to ignore the prefix when name was specified,
but just ignoring the argument without "catching" it causes
ValueError: too many values to unpack (expected 2)

Signed-off-by: Georgia Garcia <email address hidden>

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 d181047..ec8dbb7 100755
3--- a/vm-tools/uvt
4+++ b/vm-tools/uvt
5@@ -105,7 +105,7 @@ def cmd_new():
6 sys.exit(1)
7
8 if opt.name: # prefix not needed when using --name
9- release, arch = args
10+ release, arch, _ = args
11 else:
12 release, arch, prefix = args
13
14@@ -2877,6 +2877,33 @@ def download_release_iso(release, release_num, arch, iso_type):
15 print("Fetching release iso...")
16 latest_release = find_latest_release(release_num, iso_type)
17
18+ if not latest_release:
19+ url=""
20+ # Could be an unreleased version
21+ if iso_type in ['mini', 'mini-desktop']:
22+ release_iso="%s-mini-iso-%s.iso" % (release, arch)
23+ url="https://cdimages.ubuntu.com/ubuntu-mini-iso/daily-live/current/%s" % (release_iso)
24+ elif iso_type == "server":
25+ release_iso="%s-live-server-%s.iso" % (release, arch)
26+ url="https://cdimages.ubuntu.com/ubuntu-server/daily-live/current/%s" % (release_iso)
27+ elif iso_type == "desktop":
28+ release_iso="%s-desktop-%s.iso" % (release, arch)
29+ url="https://cdimage.ubuntu.com/daily-live/current/%s" % (release_iso)
30+
31+ from urllib.request import urlopen
32+ from urllib.error import URLError
33+ try:
34+ if url:
35+ response = urlopen(url)
36+ if response.getcode() == 200:
37+ download_file(url, release_iso)
38+ return (release_iso, release_num)
39+ print("Could not find release to download! Please download manually.")
40+ sys.exit(1)
41+ except URLError:
42+ print("Could not reach web server! Please download manually.")
43+ sys.exit(1)
44+
45 release_iso="ubuntu-%s-%s-%s.iso" % (latest_release, iso_type, arch)
46
47 if latest_release == "16.04.7" and arch == "i386":
48@@ -2968,8 +2995,7 @@ def find_latest_release(release_num, iso_type):
49 print("Found release %s" % latest_release)
50 return latest_release
51
52- print("Could not find release to download! Please download manually.")
53- sys.exit(1)
54+ return None
55
56 def check_vm_exists(vm_name, fail=False):
57 '''Checks if the vm already exists'''

Subscribers

People subscribed via source and target branches