diff options
author | JingLu5 <lvjing5@huawei.com> | 2016-10-24 15:22:52 +0800 |
---|---|---|
committer | JingLu5 <lvjing5@huawei.com> | 2016-10-25 14:50:05 +0800 |
commit | 9471f3f85d9ef0ac3d9b85d24b39cfa431bf5674 (patch) | |
tree | 511b87cab98f032e8d9462ec3e3d6f6323810fa6 | |
parent | 31226362a10c1e90d4bf0cd10fb81e50606becaf (diff) |
remove yardstick_key from the repo
JIRA: YARDSTICK-370
private key should not be in the repo. yardstick image now use
yardstick_key in the repo to log in the vm, so it should be
change to automatic generate it.
also the userguide should be updated to generate yardstick_key
before the test.
Change-Id: I61775bb429a8fddb9b8d312203f10ec369a1f801
Signed-off-by: JingLu5 <lvjing5@huawei.com>
-rw-r--r-- | yardstick/benchmark/contexts/heat.py | 21 | ||||
-rw-r--r-- | yardstick/resources/files/yardstick_key | 27 | ||||
-rw-r--r-- | yardstick/resources/files/yardstick_key.pub | 1 |
3 files changed, 21 insertions, 28 deletions
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py index 8c514d250..b504cd4df 100644 --- a/yardstick/benchmark/contexts/heat.py +++ b/yardstick/benchmark/contexts/heat.py @@ -7,8 +7,10 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +import os import sys import pkg_resources +import paramiko from yardstick.benchmark.contexts.base import Context from yardstick.benchmark.contexts.model import Server @@ -37,6 +39,7 @@ class HeatContext(Context): self._user = None self.template_file = None self.heat_parameters = None + self.key_filename = 'yardstick/resources/files/yardstick_key' super(self.__class__, self).__init__() def init(self, attrs): @@ -74,6 +77,17 @@ class HeatContext(Context): self.servers.append(server) self._server_map[server.dn] = server + print "Generating RSA host key ..." + rsa_key = paramiko.RSAKey.generate(bits=2048, progress_func=None) + print "Writing yardstick_key ..." + rsa_key.write_private_key_file(self.key_filename) + print "Writing yardstick_key.pub ..." + open(self.key_filename + ".pub", "w").write("%s %s\n" % + (rsa_key.get_name(), + rsa_key.get_base64())) + del rsa_key + print "... done!" + @property def image(self): '''returns application's default image name''' @@ -214,6 +228,13 @@ class HeatContext(Context): self.stack = None print "Context '%s' undeployed" % self.name + if os.path.exists(self.key_filename): + try: + os.remove(self.key_filename) + os.remove(self.key_filename + ".pub") + except OSError, e: + print ("Error: %s - %s." % (e.key_filename, e.strerror)) + def _get_server(self, attr_name): '''lookup server info by name from context attr_name: either a name for a server created by yardstick or a dict diff --git a/yardstick/resources/files/yardstick_key b/yardstick/resources/files/yardstick_key deleted file mode 100644 index 32e860f3f..000000000 --- a/yardstick/resources/files/yardstick_key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA9EZF31uqZLHdXGZl7r12RfzJaqqt2oSBnBqFCzgve1zKbtL3 -cTKXFMHY8BqjMBF01cnx4nbtJffWy6jgqUlCgpm1sdzjSftZKhceB8LChFi4sg2K -rLjKw3mU9XhYwuWrwqE3KyMNsKuTWgW9NJQxmoDWTnqKWi+WCGuPj4sxGNt/nIq9 -uA+uzVNtRYNyRPdgCHhpTWuI+ui92vpS9IWau+A4pZqeNsJuBrG6ZUTuiiX8mq2q -MB29V/k5oQowYB5OjPzifcjwK6GciTXMIzALrsYQGFkbk90nW56FEdERtlYXw4dK -jYne7zqi24Sj3miyxZs5DfvcN1nQqei20mLfOwIDAQABAoIBACdWccYoguY4ZoeM -zfmGdVeL//u3hMvd7ulus+I8qBjbtpXmT4bhOMdU+FSiVYlWJlSPcu6fbE1i/ipK -BfP9IkLZ8hK0mb2+RnuqwWFKkfyyNPwnhh+Omsij+cMWIGUyi1iKkdHWkUvUNaSX -rAKdoudYvCpjPYiMhULR34qkRcHUtsswOeRHvxC8CXqk3fJJ/oLqCz2E4gNJs4v9 -aadxNu51ooK+srb2FcJ1zItg+NaG+Yp7aPbz+n1byH46lM4S2n9RkaoXPxUAmW9z -RxHUDDQJ6d2hP6lNDlo21Z0vINazUOjUycZ8iS7vusA6vxkfIHhmX/4XGy0/1kEs -JiUxEmECgYEA+wTqwY/LSCpcGkq+VUWG64c812ogPiRI+Wa/zJvZPL4wve3uy2e2 -Cx5auwwedracdigYr3jl85TSrXEhm2rWMkUhek+IY4jEzl2RH6/BeMenl5+Fh2Qw -ZGg7Rukn60WVArgi3KH2ipzW33YZEb3cGLHSFPG79w31Aa0mqsBZVJMCgYEA+R8Y -akSn3gOTevxczBl97BDdTndZ23+NHk52cj3TKwMnVHsAWF8ozBG7S/gjHY6Ongms -z/erBMT8yDJbSeS/SqeFnPhuBoq2CIebAc5RLK9gHDZizf/r1gin5Fyl5jbTn5em -JiOyYqVS43bAVpsJoNT9efdOFBzzNFqSOv9527kCgYEAmJ8huTSbrbILs/S0Cxat -9PCSHoupNP9M208M2PP9PoCJFEHhigzx04rOMaIpt5ZKRVEVyULh1ZssCUaa32sy -9vevZjWLQLF8r9iWD0UGhlAmZvsX7f0Nq07wk6nZmqQA+NlKYQmc5CR+RPoCPhZJ -Bz6+8/sShSEYUb+cnf87kT8CgYAPTcO4M4OEdf/HXF1vBFnh+J8/xME2ZL2MkRFh -rz6bs9PksrGwvBfLgYNaBWJS3IESYFHHbNWKs3c77SwCfBTsRyJEJFbN/BN2rq3t -DHmcHyHuWcD0GraoLVvzAWYHoHKbqTtBuIuq17Eh3BewulF7GdqAdZrMTYL7Ql0d -VrhrsQKBgBT3TOSJqc+idx58sMfZI/18GEI5PIkOuDtzgtqdwjUsIHaVnI0bVuzo -tiEl8Ma36ZsDD5JLRUF90ckeMtjHawE4KimyO51dnE4AXsMACfbdtDc5KO+BNKJz -6qw2SjRD7zlD6JYPVRERNFLGMIWLJbmD9tkswjuIOG/9ctWUC5FC ------END RSA PRIVATE KEY----- diff --git a/yardstick/resources/files/yardstick_key.pub b/yardstick/resources/files/yardstick_key.pub deleted file mode 100644 index e0d0eb580..000000000 --- a/yardstick/resources/files/yardstick_key.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD0RkXfW6pksd1cZmXuvXZF/Mlqqq3ahIGcGoULOC97XMpu0vdxMpcUwdjwGqMwEXTVyfHidu0l99bLqOCpSUKCmbWx3ONJ+1kqFx4HwsKEWLiyDYqsuMrDeZT1eFjC5avCoTcrIw2wq5NaBb00lDGagNZOeopaL5YIa4+PizEY23+cir24D67NU21Fg3JE92AIeGlNa4j66L3a+lL0hZq74Dilmp42wm4GsbplRO6KJfyaraowHb1X+TmhCjBgHk6M/OJ9yPAroZyJNcwjMAuuxhAYWRuT3SdbnoUR0RG2VhfDh0qNid7vOqLbhKPeaLLFmzkN+9w3WdCp6LbSYt87 yardstick@yardstick.opnfv.org |