using the correct root_ssh_key to reach the node
[sfa.git] / sfa / methods / get_key.py
index c641985..15f520c 100644 (file)
@@ -10,6 +10,7 @@ from sfa.util.parameter import Parameter, Mixed
 from sfa.trust.auth import Auth
 from sfa.util.table import SfaTable
 from sfa.trust.certificate import Keypair
+from sfa.trust.gid import create_uuid
 
 class get_key(Method):
     """
@@ -45,7 +46,8 @@ class get_key(Method):
         # generate a new keypair and gid
         uuid = create_uuid()
         pkey = Keypair(create=True)
-        gid_object = self.api.auth.hierarchy.create_gid(record['hrn'], uuid, pkey)
+        urn = hrn_to_urn(record['hrn'], record['type'])
+        gid_object = self.api.auth.hierarchy.create_gid(urn, uuid, pkey)
         gid = gid_object.save_to_string(save_parents=True)
         record['gid'] = gid
         record.set_gid(gid)
@@ -64,7 +66,7 @@ class get_key(Method):
         key_dest="/etc/sfa/node.key"
         gid_dest="/etc/sfa/node.gid" 
         scp = "/usr/bin/scp" 
-        identity = "/etc/sfa/root_ssh_key"
+        identity = "/etc/planetlab/root_ssh_key.rsa"
         scp_options=" -i %(identity)s " % locals()
         scp_options+="-o StrictHostKeyChecking=no " % locals()
         scp_key_command="%(scp)s %(scp_options)s %(key_filename)s root@%(host)s:%(key_dest)s" %\