openstack-image-manager 0.20240403.0__tar.gz → 0.20240411.0__tar.gz

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.
Files changed (35) hide show
  1. {openstack-image-manager-0.20240403.0/openstack_image_manager.egg-info → openstack-image-manager-0.20240411.0}/PKG-INFO +2 -2
  2. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/centos.yml +10 -10
  3. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/debian.yml +7 -5
  4. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/flatcar.yml +5 -0
  5. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/ubuntu.yml +51 -20
  6. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0/openstack_image_manager.egg-info}/PKG-INFO +2 -2
  7. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/openstack_image_manager.egg-info/SOURCES.txt +1 -4
  8. openstack-image-manager-0.20240411.0/openstack_image_manager.egg-info/entry_points.txt +2 -0
  9. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/openstack_image_manager.egg-info/requires.txt +1 -1
  10. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/pyproject.toml +1 -1
  11. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/requirements.txt +1 -1
  12. openstack-image-manager-0.20240403.0/openstack_image_manager/mirror.py +0 -144
  13. openstack-image-manager-0.20240403.0/openstack_image_manager/table.py +0 -47
  14. openstack-image-manager-0.20240403.0/openstack_image_manager/update.py +0 -341
  15. openstack-image-manager-0.20240403.0/openstack_image_manager.egg-info/entry_points.txt +0 -2
  16. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/LICENSE +0 -0
  17. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/MANIFEST.in +0 -0
  18. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/README.md +0 -0
  19. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/almalinux.yml +0 -0
  20. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/cirros.yml +0 -0
  21. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/clearlinux.yml +0 -0
  22. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/fedora.yml +0 -0
  23. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/gardenlinux.yml +0 -0
  24. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/kubernetes.yml +0 -0
  25. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/opensuse.yml +0 -0
  26. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/opnsense.yml +0 -0
  27. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/osism.yml +0 -0
  28. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/rockylinux.yml +0 -0
  29. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/images/talos.yml +0 -0
  30. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/etc/schema.yaml +0 -0
  31. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/openstack_image_manager/__init__.py +0 -0
  32. /openstack-image-manager-0.20240403.0/openstack_image_manager/manage.py → /openstack-image-manager-0.20240411.0/openstack_image_manager/main.py +0 -0
  33. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/openstack_image_manager.egg-info/dependency_links.txt +0 -0
  34. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/openstack_image_manager.egg-info/top_level.txt +0 -0
  35. {openstack-image-manager-0.20240403.0 → openstack-image-manager-0.20240411.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openstack-image-manager
3
- Version: 0.20240403.0
3
+ Version: 0.20240411.0
4
4
  Summary: OpenStack image manager
5
5
  Author-email: OSISM community <info@osism.tech>
6
6
  License: Apache License
@@ -232,7 +232,7 @@ 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.12.0
235
+ Requires-Dist: typer[all]==0.12.3
236
236
  Requires-Dist: yamale==5.1.0
237
237
 
238
238
  # openstack-image-manager
@@ -59,13 +59,13 @@ images:
59
59
  latest_url:
60
60
  https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-HEREBE\d+\.\dDRAGONS.x86_64.qcow2
61
61
  versions:
62
- - version: '20240326'
62
+ - version: '20240409'
63
63
  url:
64
- https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-HEREBE\d+\.\dDRAGONS.x86_64.qcow2
64
+ https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20240408.0.x86_64.qcow2
65
65
  mirror_url:
66
- https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/centos-stream-8/20240326-centos-stream-8.qcow2
67
- checksum: sha256:35f5b4323026887470954cb458fa1628fac9db451663b37495067c5bbe7b345d
68
- build_date: 2024-03-26
66
+ https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/centos-stream-8/20240409-centos-stream-8.qcow2
67
+ checksum: sha256:f8154681ada62417944d6a45c30f65469ce40d5151499f9ee0268081608ac93c
68
+ build_date: 2024-04-09
69
69
  - name: CentOS Stream 9
70
70
  enable: true
71
71
  shortname: centos-stream-9
@@ -92,10 +92,10 @@ images:
92
92
  latest_url:
93
93
  https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-HEREBE\d+\.\dDRAGONS.x86_64.qcow2
94
94
  versions:
95
- - version: '20240326'
95
+ - version: '20240409'
96
96
  url:
97
- https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-HEREBE\d+\.\dDRAGONS.x86_64.qcow2
97
+ https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20240408.0.x86_64.qcow2
98
98
  mirror_url:
99
- https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/centos-stream-9/20240326-centos-stream-9.qcow2
100
- checksum: sha256:26a4d6d9750266d3a68cee2813aee0cc58751bf87303418b4fcdeeaa3f6dad96
101
- build_date: 2024-03-26
99
+ https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/centos-stream-9/20240409-centos-stream-9.qcow2
100
+ checksum: sha256:4fccd7b8447986b458a17365992ede43fdbf3ce5db465aa3ed5dc4c6698fbe28
101
+ build_date: 2024-04-09
@@ -47,6 +47,7 @@ images:
47
47
  meta:
48
48
  architecture: x86_64
49
49
  hw_disk_bus: scsi
50
+ hw_rng_model: virtio
50
51
  hw_scsi_model: virtio-scsi
51
52
  hw_watchdog_action: reset
52
53
  os_distro: debian
@@ -80,6 +81,7 @@ images:
80
81
  meta:
81
82
  architecture: x86_64
82
83
  hw_disk_bus: scsi
84
+ hw_rng_model: virtio
83
85
  hw_scsi_model: virtio-scsi
84
86
  hw_watchdog_action: reset
85
87
  os_distro: debian
@@ -92,11 +94,11 @@ images:
92
94
  latest_url:
93
95
  https://cdimage.debian.org/cdimage/cloud/bookworm/daily/latest/debian-12-genericcloud-amd64-daily.qcow2
94
96
  versions:
95
- - build_date: 2024-03-27
97
+ - build_date: 2024-04-11
96
98
  checksum:
97
- sha512:7d64f650164475b690690fe003f338e893374c412183d27834c80006a070581719e7e0311f8122a722390942b026c92b5ca3021e9c95b5807fe3bdf971d5edc7
99
+ sha512:3d6f26616e2c8b705993ddef874232887cebe42f1e70fcc020827ac88e8990177d537d34538c71ae2afd3b8baca953fff71eaa7ef71e752e82532c93dcdca436
98
100
  url:
99
- https://cdimage.debian.org/cdimage/cloud/bookworm/daily/latest/debian-12-genericcloud-amd64-daily.qcow2
101
+ https://cdimage.debian.org/cdimage/cloud/bookworm/daily/20240411-1714/debian-12-genericcloud-amd64-daily-20240411-1714.qcow2
100
102
  mirror_url:
101
- https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/debian-12/20240327-debian-12.qcow2
102
- version: '20240327'
103
+ https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/debian-12/20240411-debian-12.qcow2
104
+ version: '20240411'
@@ -33,3 +33,8 @@ images:
33
33
  mirror_url: https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/flatcar/3602.2.3/flatcar_production_openstack_image.img
34
34
  checksum: "sha256:23b2d10aa0adf53d58bca0d9664338bdd308bef9e56f8393d39cb5e22bff4409"
35
35
  build_date: 2023-12-11
36
+ - version: '3815.2.1'
37
+ url: https://stable.release.flatcar-linux.net/amd64-usr/3815.2.1/flatcar_production_openstack_image.img
38
+ mirror_url: https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/flatcar/3815.2.1/flatcar_production_openstack_image.img
39
+ checksum: "sha256:84d83adc4bc3537285a6193db18e437f2208d4e6f897000a86014751ac080e1f"
40
+ build_date: 2024-03-17
@@ -188,12 +188,12 @@ images:
188
188
  latest_checksum_url: https://cloud-images.ubuntu.com/focal/current/SHA256SUMS
189
189
  latest_url: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
190
190
  versions:
191
- - version: '20240306'
192
- url: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
191
+ - version: '20240408'
192
+ url: https://cloud-images.ubuntu.com/focal/20240408/focal-server-cloudimg-amd64.img
193
193
  mirror_url:
194
- https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/ubuntu-20.04/20240306-ubuntu-20.04.qcow2
195
- checksum: sha256:edf43eb9f4e5ededbb3606c719c98b0e14c956278da42567e907a17d8bccb571
196
- build_date: 2024-03-06
194
+ https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/ubuntu-20.04/20240408-ubuntu-20.04.qcow2
195
+ checksum: sha256:d3c37b0703dd847886a8316c69aa186a542c640bd370e5f98541db6c64877ebb
196
+ build_date: 2024-04-08
197
197
  - name: Ubuntu 20.04 Minimal
198
198
  enable: true
199
199
  shortname: ubuntu-20.04-minimal
@@ -220,13 +220,13 @@ images:
220
220
  latest_url:
221
221
  https://cloud-images.ubuntu.com/minimal/releases/focal/release/ubuntu-20.04-minimal-cloudimg-amd64.img
222
222
  versions:
223
- - version: '20240322'
223
+ - version: '20240408'
224
224
  url:
225
- https://cloud-images.ubuntu.com/minimal/releases/focal/release/ubuntu-20.04-minimal-cloudimg-amd64.img
225
+ https://cloud-images.ubuntu.com/minimal/releases/focal/release-20240408/ubuntu-20.04-minimal-cloudimg-amd64.img
226
226
  mirror_url:
227
- https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/ubuntu-20.04-minimal/20240322-ubuntu-20.04-minimal.qcow2
228
- checksum: sha256:25b920bd472450e31c836c1759f8fb72b4b4694654e478987744a5c77034d311
229
- build_date: 2024-03-22
227
+ https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/ubuntu-20.04-minimal/20240408-ubuntu-20.04-minimal.qcow2
228
+ checksum: sha256:1a0ffd9e85b9f2c9b61652162c482cd4b89821bff320a522f9e3eb0a1cb082eb
229
+ build_date: 2024-04-08
230
230
  - name: Ubuntu 22.04
231
231
  enable: true
232
232
  shortname: ubuntu-22.04
@@ -252,12 +252,12 @@ images:
252
252
  latest_checksum_url: https://cloud-images.ubuntu.com/jammy/current/SHA256SUMS
253
253
  latest_url: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
254
254
  versions:
255
- - version: '20240319'
256
- url: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
255
+ - version: '20240403'
256
+ url: https://cloud-images.ubuntu.com/jammy/20240403/jammy-server-cloudimg-amd64.img
257
257
  mirror_url:
258
- https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/ubuntu-22.04/20240319-ubuntu-22.04.qcow2
259
- checksum: sha256:304983616fcba6ee1452e9f38993d7d3b8a90e1eb65fb0054d672ce23294d812
260
- build_date: 2024-03-19
258
+ https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/ubuntu-22.04/20240403-ubuntu-22.04.qcow2
259
+ checksum: sha256:ceacfb01f542b1eb3b08651cc9ea9e90611ad3790a3e7eeac6f76fd553c76fe3
260
+ build_date: 2024-04-03
261
261
  - name: Ubuntu 22.04 Minimal
262
262
  enable: true
263
263
  shortname: ubuntu-22.04-minimal
@@ -284,10 +284,41 @@ images:
284
284
  latest_url:
285
285
  https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img
286
286
  versions:
287
- - version: '20240319'
287
+ - version: '20240408'
288
288
  url:
289
- https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img
289
+ https://cloud-images.ubuntu.com/minimal/releases/jammy/release-20240408/ubuntu-22.04-minimal-cloudimg-amd64.img
290
290
  mirror_url:
291
- https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/ubuntu-22.04-minimal/20240319-ubuntu-22.04-minimal.qcow2
292
- checksum: sha256:24c513a5c10cd57c68403c800dc47495ff0eceea81d7946b512f0260a9c55f6e
293
- build_date: 2024-03-19
291
+ https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/ubuntu-22.04-minimal/20240408-ubuntu-22.04-minimal.qcow2
292
+ checksum: sha256:bd99c64ad9d926eb5769f9f2cfd96ae4989a029bd64bd3e7e7deb8cff4251c65
293
+ build_date: 2024-04-08
294
+ - name: Ubuntu 24.04
295
+ enable: true
296
+ shortname: ubuntu-24.04
297
+ format: qcow2
298
+ login: ubuntu
299
+ min_disk: 8
300
+ min_ram: 512
301
+ status: active
302
+ visibility: public
303
+ multi: true
304
+ meta:
305
+ architecture: x86_64
306
+ hw_disk_bus: scsi
307
+ hw_rng_model: virtio
308
+ hw_scsi_model: virtio-scsi
309
+ hw_watchdog_action: reset
310
+ os_distro: ubuntu
311
+ os_version: '24.04'
312
+ replace_frequency: quarterly
313
+ uuid_validity: last-3
314
+ provided_until: none
315
+ tags: []
316
+ latest_checksum_url: https://cloud-images.ubuntu.com/noble/current/SHA256SUMS
317
+ latest_url: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
318
+ versions:
319
+ - version: '20240410'
320
+ url: https://cloud-images.ubuntu.com/noble/20240410/noble-server-cloudimg-amd64.img
321
+ mirror_url:
322
+ https://swift.services.a.regiocloud.tech/swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/openstack-images/ubuntu-24.04/20240410-ubuntu-24.04.qcow2
323
+ checksum: sha256:818be7da4ff41809d06b771cb98f9b1fda38edf3951171a95a6a2c5daa76653d
324
+ build_date: 2024-04-10
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openstack-image-manager
3
- Version: 0.20240403.0
3
+ Version: 0.20240411.0
4
4
  Summary: OpenStack image manager
5
5
  Author-email: OSISM community <info@osism.tech>
6
6
  License: Apache License
@@ -232,7 +232,7 @@ 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.12.0
235
+ Requires-Dist: typer[all]==0.12.3
236
236
  Requires-Dist: yamale==5.1.0
237
237
 
238
238
  # openstack-image-manager
@@ -20,10 +20,7 @@ etc/images/rockylinux.yml
20
20
  etc/images/talos.yml
21
21
  etc/images/ubuntu.yml
22
22
  openstack_image_manager/__init__.py
23
- openstack_image_manager/manage.py
24
- openstack_image_manager/mirror.py
25
- openstack_image_manager/table.py
26
- openstack_image_manager/update.py
23
+ openstack_image_manager/main.py
27
24
  openstack_image_manager.egg-info/PKG-INFO
28
25
  openstack_image_manager.egg-info/SOURCES.txt
29
26
  openstack_image_manager.egg-info/dependency_links.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ openstack-image-manager = openstack_image_manager.main:main
@@ -8,5 +8,5 @@ patool==2.2.0
8
8
  requests==2.31.0
9
9
  ruamel.yaml==0.18.6
10
10
  tabulate==0.9.0
11
- typer[all]==0.12.0
11
+ typer[all]==0.12.3
12
12
  yamale==5.1.0
@@ -43,7 +43,7 @@ dev_template = "{tag}"
43
43
  dirty_template = "{tag}"
44
44
 
45
45
  [project.scripts]
46
- openstack-image-manager = "openstack_image_manager.manage:main"
46
+ openstack-image-manager = "openstack_image_manager.main:main"
47
47
 
48
48
  [project.urls]
49
49
  "Homepage" = "https://github.com/osism/openstack-image-manager"
@@ -8,5 +8,5 @@ patool==2.2.0
8
8
  requests==2.31.0
9
9
  ruamel.yaml==0.18.6
10
10
  tabulate==0.9.0
11
- typer[all]==0.12.0
11
+ typer[all]==0.12.3
12
12
  yamale==5.1.0
@@ -1,144 +0,0 @@
1
- # SPDX-License-Identifier: Apache-2.0
2
-
3
- import os
4
- import patoolib
5
- import requests
6
- import shutil
7
- import sys
8
- import typer
9
- import yaml
10
-
11
- from loguru import logger
12
- from minio import Minio
13
- from minio.error import S3Error
14
- from os import listdir
15
- from os.path import isfile, join
16
- from urllib.parse import urlparse
17
-
18
-
19
- app = typer.Typer(add_completion=False)
20
-
21
-
22
- @app.command()
23
- def main(
24
- debug: bool = typer.Option(False, "--debug", help="Enable debug logging"),
25
- dry_run: bool = typer.Option(False, "--dry-run", help="Do not perform any changes"),
26
- images: str = typer.Option(
27
- "etc/images/", help="Path to the directory containing all image files"
28
- ),
29
- minio_access_key: str = typer.Option(
30
- None, help="Minio access key", envvar="MINIO_ACCESS_KEY"
31
- ),
32
- minio_secret_key: str = typer.Option(
33
- None, help="Minio secret key", envvar="MINIO_SECRET_KEY"
34
- ),
35
- minio_server: str = typer.Option(
36
- "swift.services.a.regiocloud.tech", help="Minio server"
37
- ),
38
- minio_bucket: str = typer.Option("openstack-images", help="Minio bucket"),
39
- ):
40
- if debug:
41
- level = "DEBUG"
42
- else:
43
- level = "INFO"
44
-
45
- log_fmt = (
46
- "<green>{time:YYYY-MM-DD HH:mm:ss}</green> | <level>{level: <8}</level> | "
47
- "<level>{message}</level>"
48
- )
49
-
50
- logger.remove()
51
- logger.add(sys.stderr, format=log_fmt, level=level, colorize=True)
52
-
53
- client = Minio(
54
- minio_server,
55
- access_key=minio_access_key,
56
- secret_key=minio_secret_key,
57
- )
58
-
59
- result = client.bucket_exists(minio_bucket)
60
- if not result:
61
- logger.error(f"Create bucket '{minio_bucket}' first")
62
- if not dry_run:
63
- sys.exit(1)
64
-
65
- onlyfiles = []
66
- for f in listdir(images):
67
- if isfile(join(images, f)):
68
- logger.debug(f"Adding {f} to the list of files")
69
- onlyfiles.append(f)
70
-
71
- all_images = []
72
- for file in [x for x in onlyfiles if x.endswith(".yml")]:
73
- logger.info(f"Processing file {file}")
74
- with open(join(images, file)) as fp:
75
- data = yaml.load(fp, Loader=yaml.SafeLoader)
76
- for image in data.get("images"):
77
- logger.debug(f"Adding {image['name']} to the list of images")
78
- all_images.append(image)
79
-
80
- for image in all_images:
81
- logger.info(f"Processing image {image['name']}")
82
-
83
- if "versions" not in image:
84
- continue
85
-
86
- for version in image["versions"]:
87
- if "source" not in version:
88
- continue
89
- else:
90
- source = version["source"]
91
-
92
- logger.debug(f"source: {source}")
93
-
94
- path = urlparse(source)
95
- url = urlparse(version["url"])
96
-
97
- dirname = f"{image['shortname']}/{version['version']}"
98
- filename, fileextension = os.path.splitext(os.path.basename(path.path))
99
- _, fileextension2 = os.path.splitext(filename)
100
-
101
- if fileextension not in [".bz2", ".zip", ".xz", ".gz"]:
102
- filename += fileextension
103
-
104
- if fileextension2 == ".tar":
105
- filename = os.path.basename(url.path)
106
-
107
- logger.debug(f"dirname: {dirname}")
108
- logger.debug(f"filename: {filename}")
109
-
110
- try:
111
- client.stat_object(minio_bucket, os.path.join(dirname, filename))
112
- logger.info(f"File {filename} available in bucket {dirname}")
113
- except S3Error:
114
- logger.info(f"File {filename} not yet available in bucket {dirname}")
115
-
116
- if not isfile(os.path.basename(path.path)):
117
- logger.info(f"Downloading {version['source']}")
118
- response = requests.get(
119
- version["source"], stream=True, allow_redirects=True
120
- )
121
- with open(os.path.basename(path.path), "wb") as fp:
122
- shutil.copyfileobj(response.raw, fp)
123
- del response
124
-
125
- if fileextension in [".bz2", ".zip", ".xz", ".gz"]:
126
- logger.info(f"Decompressing {os.path.basename(path.path)}")
127
- patoolib.extract_archive(os.path.basename(path.path), outdir=".")
128
- os.remove(os.path.basename(path.path))
129
-
130
- if not dry_run:
131
- logger.info(f"Uploading {filename} to bucket {dirname}")
132
- client.fput_object(
133
- minio_bucket, os.path.join(dirname, filename), filename
134
- )
135
- else:
136
- logger.info(
137
- f"Not uploading {filename} to bucket {dirname} (dry-run enabled)"
138
- )
139
-
140
- os.remove(filename)
141
-
142
-
143
- if __name__ == "__main__":
144
- app()
@@ -1,47 +0,0 @@
1
- # SPDX-License-Identifier: Apache-2.0
2
-
3
- import tabulate
4
- import typer
5
- import yaml
6
-
7
- from munch import Munch
8
- from os import listdir
9
- from os.path import isfile, join
10
-
11
-
12
- app = typer.Typer(add_completion=False)
13
-
14
-
15
- @app.command()
16
- def main(
17
- images: str = typer.Option(
18
- "etc/images/", help="Path to the directory containing all image files"
19
- )
20
- ):
21
- CONF = Munch.fromDict(locals())
22
-
23
- onlyfiles = []
24
- for f in listdir(CONF.images):
25
- if isfile(join(CONF.images, f)):
26
- onlyfiles.append(f)
27
-
28
- all_images = []
29
- for file in onlyfiles:
30
- with open(join(CONF.images, file)) as fp:
31
- data = yaml.load(fp, Loader=yaml.SafeLoader)
32
- imgs = data.get("images")
33
- for image in imgs:
34
- all_images.append(image)
35
-
36
- data = []
37
- for image in all_images:
38
- data.append([image["name"], image["login"], image.get("password", "")])
39
-
40
- result = tabulate.tabulate(
41
- sorted(data), headers=["Name", "Login user", "Password"], tablefmt="rst"
42
- )
43
- print(result)
44
-
45
-
46
- if __name__ == "__main__":
47
- app()
@@ -1,341 +0,0 @@
1
- # SPDX-License-Identifier: Apache-2.0
2
-
3
- # source of latest URLs: https://gitlab.com/libosinfo/osinfo-db
4
-
5
- from datetime import datetime
6
- import os
7
- import re
8
- import shutil
9
- import sys
10
- from urllib.parse import urlparse
11
- from urllib.request import urlopen
12
-
13
- from loguru import logger
14
- from minio import Minio
15
- from minio.error import S3Error
16
- from natsort import natsorted
17
- import patoolib
18
- import requests
19
- import ruamel.yaml
20
- import typer
21
-
22
- app = typer.Typer()
23
- DEBUBU_REGEX = r'<a href="([^"]+)/">(?:release-)?([0-9]+)(\-[0-9]+)?/</a>'
24
-
25
-
26
- def get_latest_default(
27
- shortname, latest_checksum_url, latest_url, checksum_type="sha256"
28
- ):
29
- result = requests.get(latest_checksum_url)
30
- result.raise_for_status()
31
-
32
- latest_filename = os.path.basename(urlparse(latest_url).path)
33
- filename_pattern = None
34
- if shortname in ["centos-stream-8", "centos-stream-9", "centos-7"]:
35
- filename_pattern = latest_filename.replace("HEREBE", "")
36
- filename_pattern = filename_pattern.replace("DRAGONS", "")
37
-
38
- checksums = {}
39
- for line in result.text.split("\n"):
40
- cs = re.split(r"\s+", line)
41
- if shortname in ["rocky-8", "rocky-9"]:
42
- if len(cs) == 4 and cs[0] == "SHA256":
43
- checksums[latest_filename] = cs[3]
44
- elif shortname in ["centos-7"]:
45
- if len(cs) == 2 and re.search(filename_pattern, cs[1]):
46
- checksums[cs[1]] = cs[0]
47
- elif shortname in ["centos-stream-8", "centos-stream-9"]:
48
- if (
49
- len(cs) == 4
50
- and cs[0] == "SHA256"
51
- and re.search(filename_pattern, cs[1][1:-1])
52
- ):
53
- checksums[cs[1][1:-1]] = cs[3]
54
- else:
55
- if len(cs) == 2:
56
- checksums[cs[1]] = cs[0]
57
-
58
- if filename_pattern:
59
- new_latest_filename = natsorted(checksums.keys())[-1]
60
- new_latest_url = latest_url.replace(latest_filename, new_latest_filename)
61
-
62
- logger.info(f"Latest URL is now {new_latest_url}")
63
- logger.info(f"Latest filename is now {new_latest_filename}")
64
-
65
- latest_filename = new_latest_filename
66
- latest_url = new_latest_url
67
-
68
- current_checksum = f"{checksum_type}:{checksums[latest_filename]}"
69
- return current_checksum, latest_url, None
70
-
71
-
72
- def resolve_debubu(base_url, rex=re.compile(DEBUBU_REGEX)):
73
- result = requests.get(base_url)
74
- result.raise_for_status()
75
- latest_folder, latest_date, latest_build = sorted(rex.findall(result.text))[-1]
76
- return latest_folder, latest_date, latest_build
77
-
78
-
79
- def get_latest_debubu(shortname, latest_checksum_url, latest_url, checksum_type=None):
80
- base_url, _, filename = latest_url.rsplit("/", 2)
81
- latest_folder, latest_date, latest_build = resolve_debubu(base_url)
82
- current_base_url = f"{base_url}/{latest_folder}"
83
- current_checksum_url = (
84
- f"{current_base_url}/{latest_checksum_url.rsplit('/', 1)[-1]}"
85
- )
86
- result = requests.get(current_checksum_url)
87
- result.raise_for_status()
88
- current_checksum = None
89
- current_filename = filename
90
- if latest_build: # Debian includes date-build in file name
91
- fn_pre, fn_suf = filename.rsplit(".", 1)
92
- current_filename = f"{fn_pre}-{latest_date}{latest_build}.{fn_suf}"
93
- for line in result.text.splitlines():
94
- cs = line.split()
95
- if len(cs) != 2:
96
- continue
97
- if cs[1].startswith("*"): # Ubuntu has the asterisk in front of the name
98
- cs[1] = cs[1][1:]
99
- if cs[1] != current_filename:
100
- continue
101
- if checksum_type is None: # use heuristics to distinguish sha256/sha512
102
- checksum_type = "sha256" if len(cs[0]) == 64 else "sha512"
103
- current_checksum = f"{checksum_type}:{cs[0]}"
104
- break
105
- if current_checksum is None:
106
- raise RuntimeError(
107
- f"{current_checksum_url} does not contain {current_filename}"
108
- )
109
- current_url = f"{current_base_url}/{current_filename}"
110
- return current_checksum, current_url, latest_date
111
-
112
-
113
- IMAGES = {
114
- "almalinux": get_latest_default,
115
- "centos": get_latest_default,
116
- "debian": get_latest_debubu,
117
- "rockylinux": get_latest_default,
118
- "ubuntu": get_latest_debubu,
119
- }
120
-
121
-
122
- def mirror_image(
123
- image, latest_url, minio_server, minio_bucket, minio_access_key, minio_secret_key
124
- ):
125
- client = Minio(
126
- minio_server,
127
- access_key=minio_access_key,
128
- secret_key=minio_secret_key,
129
- )
130
-
131
- result = client.bucket_exists(minio_bucket)
132
- if not result:
133
- logger.error(f"Create bucket '{minio_bucket}' first")
134
- return
135
-
136
- version = image["versions"][0]
137
-
138
- path = urlparse(version["url"])
139
- dirname = image["shortname"]
140
- filename, fileextension = os.path.splitext(os.path.basename(path.path))
141
-
142
- if fileextension not in [".bz2", ".zip", ".xz", ".gz"]:
143
- filename += fileextension
144
-
145
- shortname = image["shortname"]
146
- format = image["format"]
147
- new_version = version["version"]
148
- new_filename = f"{new_version}-{shortname}.{format}"
149
-
150
- try:
151
- client.stat_object(minio_bucket, os.path.join(dirname, new_filename))
152
- logger.info(f"'{new_filename}' available in '{dirname}'")
153
- except S3Error:
154
- logger.info(f"'{new_filename}' not yet available in '{dirname}'")
155
- logger.info(f"Downloading '{latest_url}'")
156
-
157
- response = requests.get(latest_url, stream=True)
158
- with open(os.path.basename(path.path), "wb") as fp:
159
- shutil.copyfileobj(response.raw, fp)
160
- del response
161
-
162
- if fileextension in [".bz2", ".zip", ".xz", ".gz"]:
163
- logger.info(f"Decompressing '{os.path.basename(path.path)}'")
164
- patoolib.extract_archive(os.path.basename(path.path), outdir=".")
165
- os.remove(os.path.basename(path.path))
166
-
167
- logger.info(f"Uploading '{filename}' to '{dirname}' as '{new_filename}'")
168
-
169
- client.fput_object(minio_bucket, os.path.join(dirname, new_filename), filename)
170
- os.remove(filename)
171
-
172
-
173
- def update_image(
174
- image,
175
- getter,
176
- minio_server,
177
- minio_bucket,
178
- minio_access_key,
179
- minio_secret_key,
180
- dry_run=False,
181
- swift_prefix="",
182
- ):
183
- name = image["name"]
184
- logger.info(f"Checking image {name}")
185
-
186
- latest_url = image["latest_url"]
187
- logger.info(f"Latest download URL is {latest_url}")
188
-
189
- latest_checksum_url = image["latest_checksum_url"]
190
- logger.info(f"Getting checksums from {latest_checksum_url}")
191
-
192
- shortname = image["shortname"]
193
- current_checksum, current_url, current_version = getter(
194
- shortname, latest_checksum_url, latest_url
195
- )
196
-
197
- logger.info(
198
- f"Checksum of current {current_url.rsplit('/', 1)[-1]} is {current_checksum}"
199
- )
200
-
201
- if not image["versions"]:
202
- logger.info("No image available so far")
203
- image["versions"].append(
204
- {
205
- "build_date": None,
206
- "checksum": None,
207
- "url": None,
208
- "version": None,
209
- }
210
- )
211
-
212
- latest_checksum = image["versions"][0]["checksum"]
213
- logger.info(f"Our checksum is {latest_checksum}")
214
-
215
- if latest_checksum == current_checksum:
216
- logger.info(f"Image {name} is up-to-date, nothing to do")
217
- return 0
218
-
219
- if current_version is None:
220
- logger.info(f"Checking {current_url}")
221
-
222
- conn = urlopen(current_url, timeout=30)
223
- dt = datetime.strptime(
224
- conn.headers["last-modified"], "%a, %d %b %Y %H:%M:%S %Z"
225
- )
226
- current_version = dt.strftime("%Y%m%d")
227
-
228
- new_values = {
229
- "version": current_version,
230
- "build_date": datetime.strptime(current_version, "%Y%m%d").date(),
231
- "checksum": current_checksum,
232
- "url": current_url,
233
- }
234
- logger.info(f"New values are {new_values}")
235
- image["versions"][0].update(new_values)
236
-
237
- shortname = image["shortname"]
238
- format = image["format"]
239
-
240
- minio_server = str(minio_server)
241
- minio_bucket = str(minio_bucket)
242
- mirror_url = f"https://{minio_server}/{swift_prefix}{minio_bucket}/{shortname}/{current_version}-{shortname}.{format}" # noqa E501
243
- logger.info(f"New URL is {mirror_url}")
244
-
245
- # If `mirror_url` is given, the manage.py script will
246
- # use `mirror_url` for the download and will use `url`
247
- # to set the `image_source` property. This way we keep
248
- # track of the original source of the image.
249
-
250
- image["versions"][0]["mirror_url"] = mirror_url
251
-
252
- # We use `current_url` here and not `latest_url` to keep track
253
- # of the original source of the image. Even if we know that `current_url`
254
- # will not be available in the future. The `latest_url` will always
255
- # be part of the image definition itself.
256
-
257
- image["versions"][0]["url"] = current_url
258
-
259
- if dry_run:
260
- logger.info(f"Not mirroring {mirror_url}, dry-run enabled")
261
- else:
262
- mirror_image(
263
- image,
264
- current_url,
265
- minio_server,
266
- minio_bucket,
267
- minio_access_key,
268
- minio_secret_key,
269
- )
270
- return 1
271
-
272
-
273
- @app.command()
274
- def main(
275
- debug: bool = typer.Option(False, "--debug", help="Enable debug logging"),
276
- dry_run: bool = typer.Option(False, "--dry-run", help="Do not perform any changes"),
277
- minio_access_key: str = typer.Option(
278
- None, help="Minio access key", envvar="MINIO_ACCESS_KEY"
279
- ),
280
- minio_secret_key: str = typer.Option(
281
- None, help="Minio secret key", envvar="MINIO_SECRET_KEY"
282
- ),
283
- minio_server: str = typer.Option(
284
- "swift.services.a.regiocloud.tech", help="Minio server", envvar="MINIO_SERVER"
285
- ),
286
- minio_bucket: str = typer.Option(
287
- "openstack-images", help="Minio bucket", envvar="MINIO_BUCKET"
288
- ),
289
- swift_prefix: str = typer.Option(
290
- "swift/v1/AUTH_b182637428444b9aa302bb8d5a5a418c/",
291
- help="Swift prefix",
292
- envvar="SWIFT_PREFIX",
293
- ),
294
- ):
295
- if debug:
296
- level = "DEBUG"
297
- else:
298
- level = "INFO"
299
-
300
- logger.remove() # remove the default sink
301
- log_fmt = (
302
- "<green>{time:YYYY-MM-DD HH:mm:ss}</green> | <level>{level: <8}</level> | "
303
- "<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>"
304
- )
305
- logger.add(sys.stderr, format=log_fmt, level=level, colorize=True)
306
-
307
- for image, getter in IMAGES.items():
308
- p = f"etc/images/{image}.yml"
309
- logger.info(f"Processing file {p}")
310
-
311
- ryaml = ruamel.yaml.YAML()
312
- with open(p) as fp:
313
- data = ryaml.load(fp)
314
-
315
- updates = 0
316
- for index, image in enumerate(data["images"]):
317
- if "latest_url" not in image:
318
- continue
319
-
320
- updates += update_image(
321
- image,
322
- getter,
323
- minio_server,
324
- minio_bucket,
325
- minio_access_key,
326
- minio_secret_key,
327
- dry_run,
328
- swift_prefix,
329
- )
330
-
331
- if not updates:
332
- continue
333
-
334
- with open(p, "w+") as fp:
335
- ryaml.explicit_start = True
336
- ryaml.indent(sequence=4, offset=2)
337
- ryaml.dump(data, fp)
338
-
339
-
340
- if __name__ == "__main__":
341
- app()
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- openstack-image-manager = openstack_image_manager.manage:main