|
19 | 19 | from pathlib import Path, PosixPath
|
20 | 20 |
|
21 | 21 | import yaml
|
| 22 | +import requests |
22 | 23 |
|
23 | 24 | BASE_PATH = Path(__file__).parent.parent
|
24 | 25 | SOURCE_PATH = BASE_PATH.joinpath("providers", "openstack", "scs")
|
@@ -238,12 +239,18 @@ def update_node_images(target: PosixPath, **kwargs):
|
238 | 239 |
|
239 | 240 | # TODO: can this magic URL be 'removed'?
|
240 | 241 | # pylint: disable=locally-disabled, line-too-long
|
241 |
| - url = f'https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-k8s-capi-images/ubuntu-2204-kube-v{kwargs["kubernetes"][0:4]}/ubuntu-2204-kube-v{kwargs["kubernetes"]}.qcow2' |
242 |
| - content["openStackNodeImages"][0]["url"] = url |
| 242 | + url = f"https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-k8s-capi-images/ubuntu-2204-kube-v{kwargs['kubernetes'][0:4]}/ubuntu-2204-kube-v{kwargs['kubernetes']}.qcow2" |
| 243 | + content["spec"]["resource"]["content"]["download"]["url"] = url |
243 | 244 |
|
244 |
| - content["openStackNodeImages"][0]["createOpts"][ |
245 |
| - "name" |
246 |
| - ] = f"ubuntu-capi-image-v{kwargs['kubernetes']}" |
| 245 | + checksum_url = f"{url}.CHECKSUM" |
| 246 | + response = requests.get(checksum_url, timeout=30) |
| 247 | + response.raise_for_status() |
| 248 | + |
| 249 | + checksum_line = response.text.strip() |
| 250 | + checksum = checksum_line.split()[0] |
| 251 | + |
| 252 | + content["spec"]["resource"]["content"]["download"]["hash"]["value"] = checksum |
| 253 | + logger.info("Updated checksum: %s", checksum) |
247 | 254 |
|
248 | 255 | writefile(target, content)
|
249 | 256 |
|
@@ -297,4 +304,6 @@ def update_node_images(target: PosixPath, **kwargs):
|
297 | 304 | )
|
298 | 305 | update_csctl_conf(output_dir.joinpath("csctl.yaml"), **tv)
|
299 | 306 | update_cluster_class(output_dir.joinpath("cluster-class"), **tv)
|
300 |
| - update_node_images(output_dir.joinpath("node-images", "config.yaml"), **tv) |
| 307 | + update_node_images( |
| 308 | + output_dir.joinpath("cluster-class", "templates", "image.yaml"), **tv |
| 309 | + ) |
0 commit comments