X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-replicated;fp=ud-replicated;h=8bef0a51d327fdeb18a6f140db908f63818f8759;hb=d443df6cb43a527b8aee45f2127c44981b048c7c;hp=1efbceadaff1e1ec332407ae6f408d540cdf63eb;hpb=c51bc7f9a820ee06e7ad88de50ef9af22eeda6e7;p=mirror%2Fuserdir-ldap.git diff --git a/ud-replicated b/ud-replicated index 1efbcea..8bef0a5 100755 --- a/ud-replicated +++ b/ud-replicated @@ -25,6 +25,7 @@ from dsa_mq.connection import Connection from dsa_mq.config import Config +import json import logging import logging.handlers import optparse @@ -77,6 +78,10 @@ def do_replicate(message): global last_run last_update = int(time.time()) timestamp = last_update + try: + message = json.loads(message) + except ValueError: + pass if isinstance(message, dict): timestamp = message.get('timestamp', last_update) @@ -120,7 +125,7 @@ def main(): sys.exit(0) if __name__ == '__main__': - do_replicate( + do_replicate(json.dumps( {'timestamp': time.time(), - 'message': 'startup complete'}) + 'message': 'startup complete'})) main()