patch by Thomas Dreibholz - ovs-vsctl and not ovs-ovsctl
[nodemanager.git] / ticket.py
index 8ba00d2..c6dc4f7 100644 (file)
--- a/ticket.py
+++ b/ticket.py
@@ -9,10 +9,14 @@ from xmlrpclib 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 <data> signed with the default GPG key."""
-    msg = dumps((data,))
+    msg = dumps((data,), methodresponse = True)
     p = _popen_gpg('--armor', '--sign', '--keyring', '/etc/planetlab/secring.gpg', '--no-default-keyring')
     p.stdin.write(msg)
     p.stdin.close()
@@ -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)