From: Tony Mack Date: Mon, 7 Dec 2009 22:55:17 +0000 (+0000) Subject: method name is get_key not request_key. use commands instead of os.system X-Git-Tag: sfa-0.9-7~191 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=40d64a62e400668c82f7f74eab780b9eb61a776b;p=sfa.git method name is get_key not request_key. use commands instead of os.system --- 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