diff options
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: |
