X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ticket.py;h=1904b81cc109361355cf788ea57c86ed02810a1c;hb=6dff11015d344650af70fb1b2ce4ac2bf3d25b39;hp=c45e8653925f47f0576ed39f1141fa55dd107a5e;hpb=7820ef492529a2c66b9cc5814c25707fdf4595fe;p=nodemanager.git diff --git a/ticket.py b/ticket.py index c45e865..1904b81 100644 --- a/ticket.py +++ b/ticket.py @@ -5,10 +5,14 @@ You must already have the key in the keyring. """ from subprocess import PIPE, Popen -from xmlrpclib import dumps, loads +from xmlrpc.client import dumps, loads GPG = '/usr/bin/gpg' +def _popen_gpg(*args): + """Return a Popen object to GPG.""" + return Popen((GPG, '--batch', '--no-tty') + args, + stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) def sign(data): """Return signed with the default GPG key.""" @@ -30,11 +34,8 @@ def verify(signed_msg): msg = p.stdout.read() p.stdout.close() p.stderr.close() - if p.wait(): return None # verification failed + if p.wait(): + return None # verification failed else: data, = loads(msg)[0] return data - -def _popen_gpg(*args): - """Return a Popen object to GPG.""" - return Popen((GPG, '--batch', '--no-tty') + args, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)