From 0b22bebc19b0d7a7ac0bbaa694b7c9be1a0e1d91 Mon Sep 17 00:00:00 2001 From: Francesco Lombardo <francesco.lombardo@garr.it> Date: Wed, 16 Feb 2022 14:55:33 +0100 Subject: [PATCH] updated config.yaml; add .gitignore; add backup directory for simplestreams; small fix in python code --- .gitignore | 3 + README.md | 4 +- ...u.cloud-released-imagemetadata_backup.json | 97 ++++++++++++++++ .../2022-02-12/index_backup.json | 36 ++++++ config.yml | 104 ++++++++++-------- generate-files-for-simplestream.py | 2 +- update-images.py | 2 +- 7 files changed, 201 insertions(+), 47 deletions(-) create mode 100644 .gitignore create mode 100644 backup-simplestreams/2022-02-12/com.ubuntu.cloud-released-imagemetadata_backup.json create mode 100644 backup-simplestreams/2022-02-12/index_backup.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29c0e30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +venv +downloads +output \ No newline at end of file diff --git a/README.md b/README.md index 9e739af..b067f7a 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,10 @@ Installation $ sudo apt install python3 python3-dev python3-pip -y $ pip3 install --upgrade pip - $ pip3 install -r requirements.txt $ git clone https://git.garr.it/cloud/admin/update-images.git + $ cd update-images + $ pip3 install -r requirements.txt + Usage ----- diff --git a/backup-simplestreams/2022-02-12/com.ubuntu.cloud-released-imagemetadata_backup.json b/backup-simplestreams/2022-02-12/com.ubuntu.cloud-released-imagemetadata_backup.json new file mode 100644 index 0000000..353b03e --- /dev/null +++ b/backup-simplestreams/2022-02-12/com.ubuntu.cloud-released-imagemetadata_backup.json @@ -0,0 +1,97 @@ +{ + "products": { + "com.ubuntu.cloud:server:16.04:amd64": { + "version": "16.04", + "arch": "amd64", + "versions": { + "20211230": { + "items": { + "1": { + "id": "2c53b6f7-6550-45fb-a9ae-f55346ca9963", + "region": "garr-ct1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + "2": { + "id": "2c53b6f7-6550-45fb-a9ae-f55346ca9963", + "region": "garr-pa1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + "3": { + "id": "2c53b6f7-6550-45fb-a9ae-f55346ca9963", + "region": "garr-na", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + "4": { + "id": "2c53b6f7-6550-45fb-a9ae-f55346ca9963", + "region": "garr-to1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + } + } + } + } + }, + "com.ubuntu.cloud:server:18.04:amd64": { + "version": "18.04", + "arch": "amd64", + "versions": { + "20211230": { + "items": { + "1": { + "id": "d83e2ce4-9048-4245-be3d-cf3f17f88fc5", + "region": "garr-ct1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + "2": { + "id": "d83e2ce4-9048-4245-be3d-cf3f17f88fc5", + "region": "garr-pa1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + "3": { + "id": "d83e2ce4-9048-4245-be3d-cf3f17f88fc5", + "region": "garr-na", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + "4": { + "id": "d83e2ce4-9048-4245-be3d-cf3f17f88fc5", + "region": "garr-to1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + } + } + } + } + }, + "com.ubuntu.cloud:server:20.04:amd64": { + "version": "20.04", + "arch": "amd64", + "versions": { + "20211230": { + "items": { + "1": { + "id": "1e742f55-d382-40d8-92f2-45ee08f75496", + "region": "garr-ct1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + "2": { + "id": "1e742f55-d382-40d8-92f2-45ee08f75496", + "region": "garr-pa1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + "3": { + "id": "1e742f55-d382-40d8-92f2-45ee08f75496", + "region": "garr-na", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + "4": { + "id": "1e742f55-d382-40d8-92f2-45ee08f75496", + "region": "garr-to1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + } + } + } + } + } + }, + "updated": "Thu, 30 Dec 2021 15:26:54 +0000", + "format": "products:1.0", + "content_id": "com.ubuntu.cloud:custom" +} \ No newline at end of file diff --git a/backup-simplestreams/2022-02-12/index_backup.json b/backup-simplestreams/2022-02-12/index_backup.json new file mode 100644 index 0000000..bab8aa4 --- /dev/null +++ b/backup-simplestreams/2022-02-12/index_backup.json @@ -0,0 +1,36 @@ +{ + "index": { + "com.ubuntu.cloud:custom": { + "updated": "Thu, 30 Dec 2021 15:26:54 +0000", + "format": "products:1.0", + "datatype": "image-ids", + "cloudname": "custom", + "clouds": [ + { + "region": "garr-ct1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + { + "region": "garr-pa1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + { + "region": "garr-na", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + }, + { + "region": "garr-to1", + "endpoint": "https://keystone.cloud.garr.it:5000/v3" + } + ], + "path": "streams/v1/com.ubuntu.cloud-released-imagemetadata.json", + "products": [ + "com.ubuntu.cloud:server:16.04:amd64", + "com.ubuntu.cloud:server:18.04:amd64", + "com.ubuntu.cloud:server:20.04:amd64" + ] + } + }, + "updated": "Thu, 30 Dec 2021 15:26:54 +0000", + "format": "index:1.0" +} \ No newline at end of file diff --git a/config.yml b/config.yml index 86cf394..ba5ff0d 100644 --- a/config.yml +++ b/config.yml @@ -1,4 +1,55 @@ images: + almaLinux: + name: AlmaLinux 8 - GARR + url: https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/AlmaLinux-8-GenericCloud-latest.x86_64.qcow2 + disk_format: qcow2 + extraargs: + - "min_disk=5" + - "min_ram=1024" + tags: + - "os_distro=almalinux" + - "os_type=linux" + - "os_version=8" + - "architecture=amd64" + - "os_require_quiesce=yes" + - "hw_qemu_guest_agent=yes" + - "hw_vif_multiqueue_enabled=true" + - "hw_rng_model=virtio" + + centos8stream: + name: CentOS Stream 8 - GARR + url: https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20220125.1.x86_64.qcow2 + disk_format: qcow2 + extraargs: + - "min_disk=5" + - "min_ram=1024" + tags: + - "os_distro=centos" + - "os_type=linux" + - "os_version=8" + - "architecture=amd64" + - "os_require_quiesce=yes" + - "hw_qemu_guest_agent=yes" + - "hw_vif_multiqueue_enabled=true" + - "hw_rng_model=virtio" + + rockylinux: + name: RockyLinux-8 - GARR + url: https://dl.rockylinux.org/pub/rocky/8.5/images/Rocky-8-GenericCloud-8.5-20211114.2.x86_64.qcow2 + disk_format: qcow2 + extraargs: + - "min_disk=5" + - "min_ram=1024" + tags: + - "os_distro=rockylinux" + - "os_type=linux" + - "os_version=8" + - "architecture=amd64" + - "os_require_quiesce=yes" + - "hw_qemu_guest_agent=yes" + - "hw_vif_multiqueue_enabled=true" + - "hw_rng_model=virtio" + debian9: name: Debian 9 - GARR url: https://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-amd64.qcow2 @@ -50,26 +101,9 @@ images: - "hw_vif_multiqueue_enabled=true" - "hw_rng_model=virtio" - fedora32: - name: Fedora 32 - GARR - url: https://fedora.mirror.garr.it/fedora/linux/releases/32/Cloud/x86_64/images/Fedora-Cloud-Base-32-1.6.x86_64.qcow2 - disk_format: qcow2 - extraargs: - - "min_disk=5" - - "min_ram=1024" - tags: - - "os_distro=fedora" - - "os_type=linux" - - "os_version=32" - - "architecture=x86_64" - - "os_require_quiesce=yes" - - "hw_qemu_guest_agent=yes" - - "hw_vif_multiqueue_enabled=true" - - "hw_rng_model=virtio" - - fedora33: - name: Fedora 33 - GARR - url: http://fedora.mirror.garr.it/fedora/linux/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2 + fedora34: + name: Fedora 34 - GARR + url: http://fedora.mirror.garr.it/fedora/linux/releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-34-1.2.x86_64.qcow2 disk_format: qcow2 extraargs: - "min_disk=5" @@ -77,16 +111,16 @@ images: tags: - "os_distro=fedora" - "os_type=linux" - - "os_version=33" + - "os_version=34" - "architecture=x86_64" - "os_require_quiesce=yes" - "hw_qemu_guest_agent=yes" - "hw_vif_multiqueue_enabled=true" - "hw_rng_model=virtio" - - fedora34: - name: Fedora 34 - GARR - url: http://fedora.mirror.garr.it/fedora/linux/releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-34-1.2.x86_64.qcow2 + + fedora35: + name: Fedora 35 - GARR + url: https://fedora.mirror.garr.it/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2 disk_format: qcow2 extraargs: - "min_disk=5" @@ -94,7 +128,7 @@ images: tags: - "os_distro=fedora" - "os_type=linux" - - "os_version=33" + - "os_version=35" - "architecture=x86_64" - "os_require_quiesce=yes" - "hw_qemu_guest_agent=yes" @@ -133,24 +167,6 @@ images: - "hw_qemu_guest_agent=yes" - "hw_vif_multiqueue_enabled=true" - ubuntu-16.04: - name: Ubuntu 16.04 - GARR - url: https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img - disk_format: qcow2 - extraargs: - - "min_disk=5" - - "min_ram=1024" - tags: - - "os_distro=ubuntu" - - "os_type=linux" - - "os_version=16.04" - - "architecture=amd64" - - "os_require_quiesce=yes" - - "hw_qemu_guest_agent=yes" - - "hw_vif_multiqueue_enabled=true" - - "hw_rng_model=virtio" - simplestreams: com.ubuntu.cloud:server:16.04:amd64 - ubuntu-18.04: name: Ubuntu 18.04 - GARR url: http://cloud-images.ubuntu.com/releases/18.04/release/ubuntu-18.04-server-cloudimg-amd64.img diff --git a/generate-files-for-simplestream.py b/generate-files-for-simplestream.py index 1b3ac64..c26ee48 100755 --- a/generate-files-for-simplestream.py +++ b/generate-files-for-simplestream.py @@ -10,7 +10,7 @@ import argparse parser = argparse.ArgumentParser(description='Generate simplestreams metadata') -parser.add_argument('-r','--regions', nargs='+', help='List of regions: e.g. -r garr-ct1 garr-pa1 garr-na \ndefault=garr-ct1 garr-pa1 garr-na', default=['garr-ct1', 'garr-pa1', 'garr-na'], required=False) +parser.add_argument('-r','--regions', nargs='+', help='List of regions: e.g. -r garr-ct1 garr-pa1 garr-na \ndefault=garr-ct1 garr-pa1 garr-na garr-to1', default=['garr-ct1', 'garr-pa1', 'garr-na', 'garr-to1'], required=False) parser.add_argument('-k','--keystone', help='Keystone endpoint: e.g. https://keystone.cloud.garr.it:5000/v3 default="https://keystone.cloud.garr.it:5000/v3"', default="https://keystone.cloud.garr.it:5000/v3", required=False) diff --git a/update-images.py b/update-images.py index 3207efa..c796384 100755 --- a/update-images.py +++ b/update-images.py @@ -30,7 +30,7 @@ def download_from_url(url, output_file): config = None with open('config.yml') as fh_config: - config = yaml.load(fh_config) + config = yaml.safe_load(fh_config) fh_config.close() download_dir = 'downloads/' -- GitLab