X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2FTestKey.py;h=4ff08ffd47f0b4ff4ba94b2b3c1c2a575cf299c7;hb=7ab545cde7518604b8bd70275da16dcfe855ac4a;hp=28032f233047d11c64925df24b91606249535d90;hpb=5963f43cd175d7882d2bd69e4971b34f927662a3;p=tests.git diff --git a/system/TestKey.py b/system/TestKey.py index 28032f2..4ff08ff 100644 --- a/system/TestKey.py +++ b/system/TestKey.py @@ -1,20 +1,37 @@ +# Thierry Parmentelat +# Copyright (C) 2010 INRIA +# import utils import os, os.path +from TestSsh import TestSsh class TestKey: def __init__ (self,test_plc,key_spec): self.test_plc=test_plc self.key_spec=key_spec + self.test_ssh=TestSsh(self.test_plc.test_ssh) def name(self): - return self.key_spec['name'] + return self.key_spec['key_name'] def publicpath(self): - return "/root/%s/keys/%s.pub"%(self.test_plc.path,self.name()) + return "keys/%s.pub"%(self.name()) def privatepath(self): - return "/root/%s/keys/%s.rsa"%(self.test_plc.path,self.name()) + return "keys/%s.rsa"%(self.name()) +#Not tested yet, don't know if needed +# def store_remote_key(self,hostname): +# pub=self.publicpath() +# priv=self.privatepath() +# utils.header("Storing key %s in %s into %s "%(self.name(),pub,hostname)) +# dir=os.path.dirname(pub) +# self.test_ssh.run("mkdir %s"%dir) +# self.test_ssh.run("cat %s >> %s"%(self.key_spec['key_fields']['key'],pub)) +# self.test_ssh.run("cat %s >> %s"%(self.key_spec['private'],priv)) +# self.test_ssh.run("chmod %s 0400"%priv) +# self.test_ssh.run("chmod %s 0444"%pub) + def store_key(self): pub=self.publicpath() priv=self.privatepath()