summaryrefslogtreecommitdiffstats
path: root/testapi
diff options
context:
space:
mode:
authorSerena Feng <feng.xiaowei@zte.com.cn>2017-09-05 02:00:33 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-05 02:00:33 +0000
commitdd14603bfe9fb57d1e26208c093e87de8f42dc61 (patch)
treefa96cf755cd37f8f8aeb2b3ff950c32cbbb04c7a /testapi
parentebffe6e27d9908dcff35a42f6ed84ebd124826a3 (diff)
parentfbbbc499f499485063aa3f18c896312077b91142 (diff)
Merge "improve: discard venv support for official product"
Diffstat (limited to 'testapi')
-rw-r--r--testapi/opnfv_testapi/common/config.py15
1 files changed, 2 insertions, 13 deletions
diff --git a/testapi/opnfv_testapi/common/config.py b/testapi/opnfv_testapi/common/config.py
index 4cd53c6..ecfffd8 100644
--- a/testapi/opnfv_testapi/common/config.py
+++ b/testapi/opnfv_testapi/common/config.py
@@ -16,7 +16,7 @@ import sys
class Config(object):
def __init__(self):
- self.config_file = None
+ self.config_file = '/etc/opnfv_testapi/config.ini'
self._set_config_file()
self._parse()
self._parse_per_page()
@@ -56,23 +56,12 @@ class Config(object):
return value
def _set_config_file(self):
- if not self._set_sys_config_file():
- self._set_default_config_file()
-
- def _set_sys_config_file(self):
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config-file", dest='config_file',
help="Config file location", metavar="FILE")
args, _ = parser.parse_known_args(sys.argv)
- try:
+ if hasattr(args, 'config_file'):
self.config_file = args.config_file
- finally:
- return self.config_file is not None
-
- def _set_default_config_file(self):
- is_venv = os.getenv('VIRTUAL_ENV')
- self.config_file = os.path.join('/' if not is_venv else is_venv,
- 'etc/opnfv_testapi/config.ini')
CONF = Config()