diff options
| author | Zuul <zuul@review.opendev.org> | 2024-02-22 13:43:09 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2024-02-22 13:43:09 +0000 |
| commit | 0246b32d70da39f6e837974f339e845f0c8b9e8f (patch) | |
| tree | a0b47f8f219469ed36eb4aa1b8d5c721d68f2f76 /kolla/image | |
| parent | 756ee984c3c761514115c342e7cba9a3cb533d02 (diff) | |
| parent | 750a137815f1ca58c7e65d23e9d63403ea282b1a (diff) | |
| download | kolla-0246b32d70da39f6e837974f339e845f0c8b9e8f.tar.gz kolla-0246b32d70da39f6e837974f339e845f0c8b9e8f.zip | |
Merge "Move curl sources to sources.py"
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: |
