Make wait-for-signed-ostree repeat the fedmsg in case the signer crashed

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2018-05-09 23:17:59 +02:00
parent 905064775a
commit 8f3c06bd14
1 changed files with 13 additions and 0 deletions

View File

@ -5,6 +5,7 @@ from __future__ import print_function
import argparse
import datetime
import fedmsg.config
import json
import os
import sys
@ -29,9 +30,21 @@ if __name__ == '__main__':
commit = data['commitid']
path = '%s/objects/%s/%s.commitmeta' % (repo, commit[:2], commit[2:])
config = fedmsg.config.load_config()
config['active'] = True # Connect out to a fedmsg-relay instance
config['cert_prefix'] = 'releng' # Use this cert.
fedmsg.init(**config)
topic = 'compose.%s' % opts.cmd.replace('-', '.').lower()
count = 0
while not os.path.exists(path):
print('%s: Commit not signed yet, waiting...'
% datetime.datetime.utcnow())
count += 1
if count >= 60: # Repeat every 5 minutes
print('Repeating notification')
fedmsg.publish(topic=topic, modname='pungi', msg=data)
count = 0
time.sleep(5)
print('Found signature.')