Skip to content

Commit 3f15a48

Browse files
committed
urlfetcher: Fix ubuntu --location $iso arch detection
Reported here: http://www.redhat.com/archives/virt-tools-list/2016-August/msg00009.html
1 parent cf1b820 commit 3f15a48

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

virtinst/urlfetcher.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,19 +1085,33 @@ class DebianDistro(Distro):
10851085
def __init__(self, *args, **kwargs):
10861086
Distro.__init__(self, *args, **kwargs)
10871087

1088-
# Pull the tree's arch out of the URL text
1089-
self._treeArch = "i386"
1090-
for pattern in ["^.*/installer-(\w+)/?$",
1091-
"^.*/daily-images/(\w+)/?$"]:
1092-
arch = re.findall(pattern, self.uri)
1093-
if arch:
1094-
self._treeArch = arch[0]
1095-
break
1096-
1088+
self._treeArch = self._find_treearch()
10971089
self._url_prefix = 'current/images'
10981090
self._installer_dirname = self.name.lower() + "-installer"
10991091
self._set_media_paths()
11001092

1093+
def _find_treearch(self):
1094+
for pattern in ["^.*/installer-(\w+)/?$",
1095+
"^.*/daily-images/(\w+)/?$"]:
1096+
arch = re.findall(pattern, self.uri)
1097+
if not arch:
1098+
continue
1099+
logging.debug("Found pattern=%s treearch=%s in uri",
1100+
pattern, arch[0])
1101+
return arch[0]
1102+
1103+
# Check for standard 'i386' and 'amd64' which will be
1104+
# in the URI name for --location $ISO mounts
1105+
for arch in ["i386", "amd64"]:
1106+
if arch in self.uri:
1107+
logging.debug("Found treearch=%s in uri", arch)
1108+
return arch
1109+
1110+
# Otherwise default to amd64
1111+
arch = "i386"
1112+
logging.debug("No treearch found in uri, defaulting to arch=%s", arch)
1113+
return arch
1114+
11011115
def _set_media_paths(self):
11021116
self._boot_iso_paths = ["%s/netboot/mini.iso" % self._url_prefix]
11031117

0 commit comments

Comments
 (0)