pungi/0006-Make-wait-for-signed-ostree-repeat-the-fedmsg-in-cas.patch
2018-05-16 13:12:45 +02:00

49 lines
1.6 KiB
Diff

From 155e60563a6f1a2d593525e563a8e45a4fc4f38c Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <puiterwijk@redhat.com>
Date: Wed, 9 May 2018 23:17:59 +0200
Subject: [PATCH 6/8] Make wait-for-signed-ostree repeat the fedmsg in case the
signer crashed
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
---
bin/pungi-wait-for-signed-ostree-handler | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/bin/pungi-wait-for-signed-ostree-handler b/bin/pungi-wait-for-signed-ostree-handler
index 98c02031..25997993 100755
--- a/bin/pungi-wait-for-signed-ostree-handler
+++ b/bin/pungi-wait-for-signed-ostree-handler
@@ -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.')
--
2.14.3