Added some precautions to the slice id-saving code.
[nodemanager.git] / ticket.py
index 8ba00d2..0292cfb 100644 (file)
--- a/ticket.py
+++ b/ticket.py
@@ -1,3 +1,6 @@
+# $Id$
+# $URL$
+
 """An extremely simple interface to the signing/verifying capabilities
 of gnupg.
 
@@ -12,7 +15,7 @@ GPG = '/usr/bin/gpg'
 
 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()
@@ -37,4 +40,4 @@ def verify(signed_msg):
 
 def _popen_gpg(*args):
     """Return a Popen object to GPG."""
-    return Popen((GPG, '--batch', '--no-tty') + args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+    return Popen((GPG, '--batch', '--no-tty') + args, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)