Code Review
/
releng.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "dovetail: create file pod.yaml for running HA test cases"
[releng.git]
/
utils
/
test
/
testapi
/
opnfv_testapi
/
common
/
config.py
diff --git
a/utils/test/testapi/opnfv_testapi/common/config.py
b/utils/test/testapi/opnfv_testapi/common/config.py
index
105d4fa
..
362fca6
100644
(file)
--- a/
utils/test/testapi/opnfv_testapi/common/config.py
+++ b/
utils/test/testapi/opnfv_testapi/common/config.py
@@
-30,7
+30,7
@@
class APIConfig(object):
"""
def __init__(self):
"""
def __init__(self):
- self._
default_config_location = "/etc/opnfv_testapi/config.ini"
+ self._
set_default_config()
self.mongo_url = None
self.mongo_dbname = None
self.api_port = None
self.mongo_url = None
self.mongo_dbname = None
self.api_port = None
@@
-39,6
+39,11
@@
class APIConfig(object):
self._parser = None
self.swagger_base_url = None
self._parser = None
self.swagger_base_url = None
+ def _set_default_config(self):
+ venv = os.getenv('VIRTUAL_ENV')
+ self._default_config = os.path.join('/' if not venv else venv,
+ 'etc/opnfv_testapi/config.ini')
+
def _get_parameter(self, section, param):
try:
return self._parser.get(section, param)
def _get_parameter(self, section, param):
try:
return self._parser.get(section, param)
@@
-66,7
+71,7
@@
class APIConfig(object):
obj = APIConfig()
if config_location is None:
obj = APIConfig()
if config_location is None:
- config_location = obj._default_config
_location
+ config_location = obj._default_config
if not os.path.exists(config_location):
raise ParseError("%s not found" % config_location)
if not os.path.exists(config_location):
raise ParseError("%s not found" % config_location)