Skip to content

Commit 841bdd0

Browse files
committed
Merge branch 'update/deps' into devel
2 parents 2780df0 + ea3ea84 commit 841bdd0

File tree

6 files changed

+906
-1001
lines changed

6 files changed

+906
-1001
lines changed

Diff for: Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ update: setup_poetry
1414
poetry update
1515

1616
clean:
17-
poetry env list | cut -d' ' -f1 | xargs poetry env remove
18-
rm .mk_poetry*
17+
poetry env remove --all
18+
rm -rf .mk_poetry* dist
1919

2020
check: setup_poetry
2121
poetry run flake8 osia --max-line-length 100 --show-source --statistics
@@ -27,4 +27,4 @@ dist: setup_poetry
2727
release: dist
2828
poetry publish
2929

30-
.PHONY: update clean all check
30+
.PHONY: update clean all check

Diff for: osia/installer/clouds/openstack.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
import warnings
2424
import logging
2525

26-
from munch import Munch
2726
from openstack.connection import from_config, Connection
2827
from openstack.network.v2.floating_ip import FloatingIP
28+
from openstack.network.v2.port import Port
2929
from openstack.image.v2.image import Image
3030
from openstack.exceptions import SDKException
3131
from osia.installer.clouds.base import AbstractInstaller
@@ -99,7 +99,7 @@ def _find_fit_network(osp_connection: Connection,
9999
named_networks = {k['name']: k for k in osp_connection.list_networks() if k['name'] in networks}
100100
results = {}
101101
for net_name in networks:
102-
net_avail = osp_connection.network.get_network_ip_availability(named_networks[net_name])
102+
net_avail = osp_connection.network.get_network_ip_availability(named_networks[net_name].id)
103103
subnet_usage = [(subnet['total_ips'], subnet['used_ips'])
104104
for subnet in net_avail.subnet_ip_availability if subnet['ip_version'] == 4]
105105
total_ips, used_ips = [sum(i) for i in zip(*subnet_usage)]
@@ -108,7 +108,7 @@ def _find_fit_network(osp_connection: Connection,
108108
return named_networks[result]['id'], result
109109

110110

111-
def _find_cluster_ports(osp_connection: Connection, cluster_name: str) -> Munch:
111+
def _find_cluster_ports(osp_connection: Connection, cluster_name: str) -> Port:
112112
port_list = [k for k in osp_connection.list_ports()
113113
if k.name.startswith(cluster_name) and k.name.endswith('ingress-port')]
114114
port = next(iter(port_list), None)

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

+17-15
Original file line numberDiff line numberDiff line change
@@ -36,41 +36,43 @@
3636
PREVIEW_ROOT = "http://mirror.openshift.com/pub/openshift-v4/{}/clients/ocp-dev-preview/"
3737

3838
VERSION_RE = re.compile(r"^openshift-install-(?P<platform>\w+)"
39-
r"(?P<architecture>-\w+)?-(?P<version>\d+.*)\.tar\.gz")
39+
r"(-(?P<architecture>\w+))?-(?P<version>\d+.*)\.tar\.gz")
4040
EXTRACTION_RE = re.compile(r'.*Extracting tools for .*, may take up to a minute.*')
4141

4242

4343
def _current_platform():
4444
if platform.system() == "Linux" and platform.machine() == "x86_64":
4545
return "linux", "amd64"
46+
if platform.system() == "Linux" and platform.machine() == "arm64":
47+
return "linux", "arm64"
4648
if platform.system() == "Darwin" and platform.machine() == "arm64":
4749
return "mac", "arm64"
4850
if platform.system() == "Darwin" and platform.machine() == "x86_64":
49-
return "mac", None
51+
return "mac", "amd64"
5052
raise Exception(f"Unrecognized platform {platform.system()} {platform.machine()}")
5153

5254

53-
def get_url(directory: str) -> Tuple[Optional[str], Optional[str]]:
55+
def get_url(directory: str, arch: str) -> Tuple[Optional[str], Optional[str]]:
5456
"""Searches the http directory and returns both url to installer
5557
and version.
5658
"""
5759
lst = requests.get(directory, allow_redirects=True)
5860
tree = BeautifulSoup(lst.content, 'html.parser')
5961
links = tree.find_all('a')
6062
installer, version = None, None
61-
os_name, arch = _current_platform()
63+
os_name, local_arch = _current_platform()
6264
for k in links:
6365
match = VERSION_RE.match(k.get('href'))
6466
if match and match.group('platform') == os_name:
65-
if (arch and not match.group('architecture')) \
66-
or (not arch and match.group('architecture')):
67-
continue
68-
installer = lst.url + k.get('href')
69-
version = match.group('version')
67+
if (local_arch == match.group('architecture')) \
68+
or (local_arch == arch and not match.group('architecture')):
69+
installer = lst.url + k.get('href')
70+
version = match.group('version')
71+
break
7072
return installer, version
7173

7274

73-
def get_devel_url(version: str) -> str:
75+
def get_devel_url(version: str, arch: str) -> Tuple[Optional[str], Optional[str]]:
7476
"""
7577
Searches developement sources and returns url to installer
7678
"""
@@ -83,17 +85,17 @@ def get_devel_url(version: str) -> str:
8385
req = requests.get(BUILD_ROOT + version, allow_redirects=True)
8486
ast = BeautifulSoup(req.content, 'html.parser')
8587
logging.debug('Installer found on page, continuing')
86-
return get_url(req.url)
88+
return get_url(req.url, arch)
8789

8890

89-
def get_prev_url(version, arch):
91+
def get_prev_url(version: str, arch: str) -> Tuple[Optional[str], Optional[str]]:
9092
"""Returns installer url from dev-preview sources"""
91-
return get_url(PREVIEW_ROOT.format(arch) + version)
93+
return get_url(PREVIEW_ROOT.format(arch) + version, arch)
9294

9395

94-
def get_prod_url(version, arch):
96+
def get_prod_url(version: str, arch: str) -> Tuple[Optional[str], Optional[str]]:
9597
"""Returns installer url from production sources"""
96-
return get_url(PROD_ROOT.format(arch) + version)
98+
return get_url(PROD_ROOT.format(arch) + version, arch)
9799

98100

99101
def _get_storage_path(version: str, install_base: str) -> str:

0 commit comments

Comments
 (0)