From d589e4e5345ed82c68d9a011ac89f8cdbefe2ca3 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Wed, 14 Feb 2018 16:02:53 +0100 Subject: Get properly env vars or their default values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It defines env.get() as an unique way to get Functest env vars or their default values. It can be considered as a wrapper above os.environ. It enforces backward compatibility via CONST which mustn't be used for that purpose. It should be noted that it also stops using CONST for getting OpenStack env vars. Change-Id: I333dc1afbc0123166a7eaff8b551370098efa341 Signed-off-by: Cédric Ollivier --- functest/utils/constants.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'functest/utils/constants.py') diff --git a/functest/utils/constants.py b/functest/utils/constants.py index c19e0fc5..d8a1d54d 100644 --- a/functest/utils/constants.py +++ b/functest/utils/constants.py @@ -2,6 +2,7 @@ # pylint: disable=missing-docstring +import pkg_resources import six from functest.utils import config @@ -10,6 +11,9 @@ from functest.utils import env class Constants(object): # pylint: disable=too-few-public-methods + CONFIG_FUNCTEST_YAML = pkg_resources.resource_filename( + 'functest', 'ci/config_functest.yaml') + def __init__(self): for attr_n, attr_v in six.iteritems(config.CONF.__dict__): setattr(self, attr_n, attr_v) -- cgit 1.2.3-korg