diff options
author | chenjiankun <chenjiankun1@huawei.com> | 2017-08-28 09:55:05 +0000 |
---|---|---|
committer | chenjiankun <chenjiankun1@huawei.com> | 2017-08-28 09:55:05 +0000 |
commit | 731a5bcfacc17c9189837d2af2d5dc1f0a95ccff (patch) | |
tree | b51f0537dffb2009813b42d5afccc4af235c1355 /yardstick/benchmark/contexts | |
parent | 952ccb549c08b620a35f20ae809e0cea88ae4d99 (diff) |
Kubernetes context adoption when run in CI
JIRA: YARDSTICK-801
We need kubernetes test case run in CI.
We have one scenario k8-nosdb-lb-noha for kubernetes.
But for now, we need to do some adoption in CI script.
Also I move check OS_AUTH_URL in heat.py.
Change-Id: Iff86caf77fd74e70469ad2dc43f2238097ce0001
Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'yardstick/benchmark/contexts')
-rw-r--r-- | yardstick/benchmark/contexts/heat.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py index e52c1076c..deed4af93 100644 --- a/yardstick/benchmark/contexts/heat.py +++ b/yardstick/benchmark/contexts/heat.py @@ -14,6 +14,7 @@ import collections import logging import os import uuid +import errno from collections import OrderedDict import ipaddress @@ -26,7 +27,8 @@ from yardstick.benchmark.contexts.model import Server from yardstick.benchmark.contexts.model import update_scheduler_hints from yardstick.common.openstack_utils import get_neutron_client from yardstick.orchestrator.heat import HeatTemplate, get_short_key_uuid -from yardstick.common.constants import YARDSTICK_ROOT_PATH +from yardstick.common import constants as consts +from yardstick.common.utils import source_env from yardstick.ssh import SSH LOG = logging.getLogger(__name__) @@ -71,7 +73,7 @@ class HeatContext(Context): self.key_uuid = uuid.uuid4() self.heat_timeout = None self.key_filename = ''.join( - [YARDSTICK_ROOT_PATH, 'yardstick/resources/files/yardstick_key-', + [consts.YARDSTICK_ROOT_PATH, 'yardstick/resources/files/yardstick_key-', get_short_key_uuid(self.key_uuid)]) super(HeatContext, self).__init__() @@ -88,6 +90,7 @@ class HeatContext(Context): return sorted_networks def init(self, attrs): + self.check_environment() """initializes itself from the supplied arguments""" self.name = attrs["name"] @@ -131,6 +134,19 @@ class HeatContext(Context): self.attrs = attrs SSH.gen_keys(self.key_filename) + def check_environment(self): + try: + os.environ['OS_AUTH_URL'] + except KeyError: + try: + source_env(consts.OPENRC) + except IOError as e: + if e.errno != errno.EEXIST: + LOG.error('OPENRC file not found') + raise + else: + LOG.error('OS_AUTH_URL not found') + @property def image(self): """returns application's default image name""" |