From 40d64a62e400668c82f7f74eab780b9eb61a776b Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Mon, 7 Dec 2009 22:55:17 +0000 Subject: [PATCH] method name is get_key not request_key. use commands instead of os.system --- sfa/methods/get_key.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sfa/methods/get_key.py b/sfa/methods/get_key.py index 6e84d32c..8f2c2f21 100644 --- a/sfa/methods/get_key.py +++ b/sfa/methods/get_key.py @@ -2,13 +2,14 @@ ### $URL: $ import os import tempfile +import commands from sfa.util.faults import * from sfa.util.misc import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed from sfa.trust.auth import Auth -class request_key(Method): +class get_key(Method): """ Generate a new keypair and gid for requesting caller (component). @return 1 If successful @@ -57,7 +58,10 @@ class request_key(Method): host = node['hostname'] dest="/etc/sfa/nodekey.key" identity = "/etc/planetlab/root_ssh_key.pub" - os.system("scp -i %(identity)s %(filename)s root@%(host)s:%(dest)s" % locals() - os.remove(filename) + scp_command = "scp -i %(identity)s %(filename)s root@%(host)s:%(dest)s" % locals() + (status, output) = commands(scp_command) + if status: + raise Exception, output + os.unlink(filename) return 1 -- 2.43.0