Commit d495a148 authored by Łukasz Nowak's avatar Łukasz Nowak

- assume that non bootstraped server or empty received dicts are wrong

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25765 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8c88c250
...@@ -35,16 +35,24 @@ import sys ...@@ -35,16 +35,24 @@ import sys
from struct import pack from struct import pack
from base64 import encodestring from base64 import encodestring
from pprint import pprint from pprint import pprint
from time import sleep
def main(): def main():
address = sys.argv[1] address = sys.argv[1]
port = int(sys.argv[2]) port = int(sys.argv[2])
client = TIDClient((address, port)) client = TIDClient((address, port))
if not client.bootstraped():
raise ValueError('Server not bootstraped')
dump_dict = client.dump_all() dump_dict = client.dump_all()
if not dump_dict:
raise ValueError('Received empty dict from server')
for key,value in dump_dict.iteritems(): for key,value in dump_dict.iteritems():
dump_dict[key] = encodestring(pack('>Q', value)).rstrip() dump_dict[key] = encodestring(pack('>Q', value)).rstrip()
pprint(dump_dict) pprint(dump_dict)
if __name__ == '__main__': if __name__ == '__main__':
assert len(sys.argv) == 3, 'Requires exactly 2 arguments: <address> <port>' assert len(sys.argv) == 3, 'Requires exactly 2 arguments: <address> <port>'
sys.exit(main()) sys.exit(main())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment