Skip to content

Commit 8b19254

Browse files
authored
Merge pull request #82 from Frawless/deal-with-installer-rename
Add more logging for downloader and fix URLs for openshift-installer
2 parents 46c495d + 5f632a8 commit 8b19254

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: osia/installer/downloader/install.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,22 @@ def _current_platform():
4949
return "mac", "arm64"
5050
if platform.system() == "Darwin" and platform.machine() == "x86_64":
5151
return "mac", "amd64"
52+
5253
raise Exception(f"Unrecognized platform {platform.system()} {platform.machine()}")
5354

5455

5556
def get_url(directory: str, arch: str) -> Tuple[Optional[str], Optional[str]]:
5657
"""Searches the http directory and returns both url to installer
5758
and version.
5859
"""
60+
logging.debug('Url for installers look-up %s', directory)
5961
lst = requests.get(directory, allow_redirects=True)
6062
tree = BeautifulSoup(lst.content, 'html.parser')
6163
links = tree.find_all('a')
6264
installer, version = None, None
6365
os_name, local_arch = _current_platform()
6466
for k in links:
67+
logging.debug('Parsing link: %s', k.get('href'))
6568
match = VERSION_RE.match(k.get('href'))
6669
if match and match.group('platform') == os_name:
6770
if (local_arch == match.group('architecture')) \
@@ -76,7 +79,7 @@ def get_devel_url(version: str, arch: str) -> Tuple[Optional[str], Optional[str]
7679
"""
7780
Searches developement sources and returns url to installer
7881
"""
79-
req = requests.get(BUILD_ROOT + version, allow_redirects=True)
82+
req = requests.get(BUILD_ROOT + version + "/", allow_redirects=True)
8083
ast = BeautifulSoup(req.content, 'html.parser')
8184
logging.info('Checking stage repository for installer')
8285
while len(ast.find_all('p')) != 0 and EXTRACTION_RE.match(next(ast.find_all('p')[0].children)):
@@ -90,12 +93,12 @@ def get_devel_url(version: str, arch: str) -> Tuple[Optional[str], Optional[str]
9093

9194
def get_prev_url(version: str, arch: str) -> Tuple[Optional[str], Optional[str]]:
9295
"""Returns installer url from dev-preview sources"""
93-
return get_url(PREVIEW_ROOT.format(arch) + version, arch)
96+
return get_url(PREVIEW_ROOT.format(arch) + version + "/", arch)
9497

9598

9699
def get_prod_url(version: str, arch: str) -> Tuple[Optional[str], Optional[str]]:
97100
"""Returns installer url from production sources"""
98-
return get_url(PROD_ROOT.format(arch) + version, arch)
101+
return get_url(PROD_ROOT.format(arch) + version + "/", arch)
99102

100103

101104
def _get_storage_path(version: str, install_base: str) -> str:
@@ -147,6 +150,7 @@ def download_installer(installer_version: str,
147150
raise Exception("Error for source profile " + source)
148151

149152
url, version = downloader(installer_version, installer_arch)
153+
logging.debug('Installer\'s URL is %s and full version is %s', url, version)
150154
root = Path(dest_directory).joinpath(version)
151155

152156
if root.exists() and root.joinpath('openshift-install').exists():

0 commit comments

Comments
 (0)