openstack-image-manager 0.20240318.0__py3-none-any.whl → 0.20240327.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ import os
8
8
  import re
9
9
  import sys
10
10
  import typer
11
+ import typing
11
12
  from typing import Dict, Set
12
13
  import yamale
13
14
  import urllib.parse
@@ -371,7 +372,7 @@ class ImageManager:
371
372
 
372
373
  def import_image(
373
374
  self, image: dict, name: str, url: str, versions: dict, version: str
374
- ) -> Image | None:
375
+ ) -> typing.Union[Image, None]:
375
376
  """
376
377
  Create a new image in Glance and upload it using the web-download method
377
378
 
@@ -461,7 +462,7 @@ class ImageManager:
461
462
  )
462
463
  return result
463
464
 
464
- def wait_for_image(self, image: Image) -> Image | None:
465
+ def wait_for_image(self, image: Image) -> typing.Union[Image, None]:
465
466
  """
466
467
  Wait for an imported image to reach "active" state
467
468
 
@@ -37,7 +37,7 @@ def get_latest_default(
37
37
 
38
38
  checksums = {}
39
39
  for line in result.text.split("\n"):
40
- cs = re.split("\s+", line) # noqa W605
40
+ cs = re.split(r"\s+", line)
41
41
  if shortname in ["rocky-8", "rocky-9"]:
42
42
  if len(cs) == 4 and cs[0] == "SHA256":
43
43
  checksums[latest_filename] = cs[3]
@@ -241,12 +241,25 @@ def update_image(
241
241
 
242
242
  minio_server = str(minio_server)
243
243
  minio_bucket = str(minio_bucket)
244
- new_url = f"https://{minio_server}/{swift_prefix}{minio_bucket}/{shortname}/{current_version}-{shortname}.{format}"
245
- logger.info(f"New URL is {new_url}")
246
- image["versions"][0]["url"] = new_url
244
+ mirror_url = f"https://{minio_server}/{swift_prefix}{minio_bucket}/{shortname}/{current_version}-{shortname}.{format}" # noqa E501
245
+ logger.info(f"New URL is {mirror_url}")
246
+
247
+ # If `mirror_url` is given, the manage.py script will
248
+ # use `mirror_url` for the download and will use `url`
249
+ # to set the `image_source` property. This way we keep
250
+ # track of the original source of the image.
251
+
252
+ image["versions"][0]["mirror_url"] = mirror_url
253
+
254
+ # We use `current_url` here and not `latest_url` to keep track
255
+ # of the original source of the image. Even if we know that `current_url`
256
+ # will not be available in the future. The `latest_url` will always
257
+ # be part of the image definition itself.
258
+
259
+ image["versions"][0]["url"] = current_url
247
260
 
248
261
  if dry_run:
249
- logger.info(f"Not mirroring {new_url}, dry-run enabled")
262
+ logger.info(f"Not mirroring {mirror_url}, dry-run enabled")
250
263
  else:
251
264
  mirror_image(
252
265
  image,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openstack-image-manager
3
- Version: 0.20240318.0
3
+ Version: 0.20240327.0
4
4
  Summary: OpenStack image manager
5
5
  Author-email: OSISM community <info@osism.tech>
6
6
  License: Apache License
@@ -232,13 +232,13 @@ Requires-Dist: patool ==2.2.0
232
232
  Requires-Dist: requests ==2.31.0
233
233
  Requires-Dist: ruamel.yaml ==0.18.6
234
234
  Requires-Dist: tabulate ==0.9.0
235
- Requires-Dist: typer[all] ==0.9.0
236
- Requires-Dist: yamale ==5.0.0
235
+ Requires-Dist: typer[all] ==0.11.0
236
+ Requires-Dist: yamale ==5.1.0
237
237
 
238
238
  # openstack-image-manager
239
239
 
240
240
  [![PyPi version](https://badgen.net/pypi/v/openstack-image-manager/)](https://pypi.org/project/openstack-image-manager/)
241
241
  [![PyPi license](https://badgen.net/pypi/license/openstack-image-manager/)](https://pypi.org/project/openstack-image-manager/)
242
- [![Documentation](https://img.shields.io/static/v1?label=&message=documentation&color=blue)](https://osism.github.io/docs/guides/operations-guide/openstack/day2-operations/image-manager)
242
+ [![Documentation](https://img.shields.io/static/v1?label=&message=documentation&color=blue)](https://osism.tech/docs/guides/operations-guide/openstack/day2-operations/image-manager)
243
243
 
244
244
  Easily manage and keep up to date a large number of images on an OpenStack environment
@@ -0,0 +1,11 @@
1
+ openstack_image_manager/__init__.py,sha256=z6lQHDMfCV8IkUz5pM1QYfQ37O2Rdy82jYovN8N9DIU,240
2
+ openstack_image_manager/manage.py,sha256=zEspJ8vKHg3xT2trKOmf1fCUsIMlJFxXU1BeOt-At-E,47728
3
+ openstack_image_manager/mirror.py,sha256=_84-vAFfF1a3IuDBzluwTJWo20cyJEJaNIcxn3X87QI,4737
4
+ openstack_image_manager/table.py,sha256=cZ6Xuqp8uh2V5_uzT4KwWoiLAUdvsPZkrPjOXdxFeU4,1080
5
+ openstack_image_manager/update.py,sha256=kSEG3HJPAtazIy9S2uEuLOZq4VDOpZifeO8OngClcK0,11103
6
+ openstack_image_manager-0.20240327.0.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
7
+ openstack_image_manager-0.20240327.0.dist-info/METADATA,sha256=zg24GictICQvJaQm_BuP6llALIY4s-8ri_kW03Pb6cU,14871
8
+ openstack_image_manager-0.20240327.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
9
+ openstack_image_manager-0.20240327.0.dist-info/entry_points.txt,sha256=AEHPHHHZ3jAZfpvaI5ZzLi3DHb9vGQwL7TJcw_G_5nc,80
10
+ openstack_image_manager-0.20240327.0.dist-info/top_level.txt,sha256=iLfREddId51T97Dr9IGRQtJXKJgVy1PB6uHCaQk1j44,24
11
+ openstack_image_manager-0.20240327.0.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- openstack_image_manager/__init__.py,sha256=z6lQHDMfCV8IkUz5pM1QYfQ37O2Rdy82jYovN8N9DIU,240
2
- openstack_image_manager/manage.py,sha256=biCPWdV5-_4rI_6DtieOWe_HXrcnWP67hs1RzwnOdts,47688
3
- openstack_image_manager/mirror.py,sha256=_84-vAFfF1a3IuDBzluwTJWo20cyJEJaNIcxn3X87QI,4737
4
- openstack_image_manager/table.py,sha256=cZ6Xuqp8uh2V5_uzT4KwWoiLAUdvsPZkrPjOXdxFeU4,1080
5
- openstack_image_manager/update.py,sha256=RBH47LjWsWVKaYVwBxlDviSSZY6RxUyUQdrwtKG5bKs,10545
6
- openstack_image_manager-0.20240318.0.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
7
- openstack_image_manager-0.20240318.0.dist-info/METADATA,sha256=IEeNJuQY-DBWauuhBsj2CZzHGRWHLbGg4LeU6X_Ua1g,14875
8
- openstack_image_manager-0.20240318.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
9
- openstack_image_manager-0.20240318.0.dist-info/entry_points.txt,sha256=AEHPHHHZ3jAZfpvaI5ZzLi3DHb9vGQwL7TJcw_G_5nc,80
10
- openstack_image_manager-0.20240318.0.dist-info/top_level.txt,sha256=iLfREddId51T97Dr9IGRQtJXKJgVy1PB6uHCaQk1j44,24
11
- openstack_image_manager-0.20240318.0.dist-info/RECORD,,