diff --git a/bin/pungi-wait-for-signed-ostree-handler b/bin/pungi-wait-for-signed-ostree-handler new file mode 100755 index 00000000..98c02031 --- /dev/null +++ b/bin/pungi-wait-for-signed-ostree-handler @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import print_function + +import argparse +import datetime +import json +import os +import sys +import time + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('cmd') + opts = parser.parse_args() + + if opts.cmd != 'ostree': + # Not an announcement of new ostree commit, nothing to do. + sys.exit() + + try: + data = json.load(sys.stdin) + except ValueError: + print('Failed to decode data', file=sys.stderr) + sys.exit(1) + + repo = data['local_repo_path'] + commit = data['commitid'] + path = '%s/objects/%s/%s.commitmeta' % (repo, commit[:2], commit[2:]) + + while not os.path.exists(path): + print('%s: Commit not signed yet, waiting...' + % datetime.datetime.utcnow()) + time.sleep(5) + + print('Found signature.') diff --git a/setup.py b/setup.py index 01b6bbe7..1e5d1da3 100755 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ setup( 'bin/pungi-koji', 'bin/pungi-make-ostree', 'bin/pungi-patch-iso', + 'bin/pungi-wait-for-signed-ostree-handler', 'contrib/yum-dnf-compare/pungi-compare-depsolving', ],