diff options
| author | Michal Nasiadka <mnasiadka@gmail.com> | 2024-02-14 14:02:50 +0100 |
|---|---|---|
| committer | Michal Nasiadka <mnasiadka@gmail.com> | 2024-02-21 08:26:52 +0000 |
| commit | 750a137815f1ca58c7e65d23e9d63403ea282b1a (patch) | |
| tree | 3011be637b499ead30126f12be82d39a1bc69c5b /kolla/image | |
| parent | b276a9cdb52502a9abe1b0f3cf866d952f201b5d (diff) | |
| download | kolla-750a137815f1ca58c7e65d23e9d63403ea282b1a.tar.gz kolla-750a137815f1ca58c7e65d23e9d63403ea282b1a.zip | |
Move curl sources to sources.py
Move most curl sources to sources.py, so it can be automatically
updated in future.
This also makes overriding the versions/locations/sha256 easier.
Change-Id: Ib3497fe96162ae190e5c113cacaaa3ef8334f590
Diffstat (limited to 'kolla/image')
| -rw-r--r-- | kolla/image/kolla_worker.py | 1 | ||||
| -rw-r--r-- | kolla/image/tasks.py | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/kolla/image/kolla_worker.py b/kolla/image/kolla_worker.py index 3ea290d06..b959ec754 100644 --- a/kolla/image/kolla_worker.py +++ b/kolla/image/kolla_worker.py @@ -636,6 +636,7 @@ class KollaWorker(object): if installation['type'] == 'git': installation['reference'] = self.conf[section]['reference'] installation['enabled'] = self.conf[section]['enabled'] + installation['sha256'] = self.conf[section]['sha256'] return installation all_sections = (set(self.conf._groups.keys()) | diff --git a/kolla/image/tasks.py b/kolla/image/tasks.py index c6cde6bbe..e9790b708 100644 --- a/kolla/image/tasks.py +++ b/kolla/image/tasks.py @@ -12,6 +12,7 @@ import datetime import errno +import hashlib import json import os import shutil @@ -198,6 +199,17 @@ class BuildTask(EngineTask): return if r.status_code == 200: + if source.get('sha256'): + conf_sha = source['sha256'][self.conf.debian_arch] + computed_sha = hashlib.sha256(r.content).hexdigest() + if conf_sha != computed_sha: + self.logger.error("%s SHA256 checksum does not match" + "(configured: %s, computed: %s)", + source['source'], + conf_sha, + computed_sha) + image.status = Status.ERROR + return with open(dest_archive, 'wb') as f: f.write(r.content) else: |
