From 6378e016033674e2fdcae2bcb3822b30351ea684 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 19 Oct 2012 13:10:28 -0400 Subject: [PATCH] check-mirroring: pretty-print humbugs. (imported from commit 603da610993a915f1bef7f6c03ccf62414545931) --- check-mirroring | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/check-mirroring b/check-mirroring index 600be4d..db60361 100755 --- a/check-mirroring +++ b/check-mirroring @@ -49,6 +49,14 @@ humbug_client = api.common.HumbugAPI(email=humbug_user, def print_zephyr(notice): print notice.cls, notice.instance, notice.sender, notice.message.split('\0')[1] +def print_humbug(message): + if message['type'] == "stream": + print message["type"], message['display_recipient'], message['subject'], \ + message['sender_email'], message['content'] + else: + print message["type"], message['sender_email'], \ + message['display_recipient'], message['content'] + child_pid = os.fork() if child_pid == 0: # Run the humbug => zephyr mirror in the child @@ -126,14 +134,16 @@ else: 'server_generation': '0'})['messages'] if len(messages) != 4: print "zephyr=>humbug: Didn't get exactly 4 messages!" - print messages + for message in messages: + print_humbug(message) failed = True elif (messages[0]['content'] != str(hzkey1) or messages[1]['content'] != str(hzkey2) or messages[2]['content'] != str(zhkey1) or messages[3]['content'] != str(zhkey2)): print "zephyr=>humbug: Didn't get back right values!" - print messages + for message in messages: + print_humbug(message) failed = True if failed: