aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-05 18:03:53 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-06 20:00:43 +0200
commitf15eaf95de326271eb2e1c4067c84d64458edb65 (patch)
treeff31b4088eb846c7bdb23458d3f5b2376bdcf1dd
parent6a688d6bde6707b86723241dd614a3d9689a957a (diff)
add cmdline arg to set conf dir
Add -c cmdline option to do the same as / in addition to the OSMO_GSM_TESTER_CONF var, because setting the var is cumbersome in daily development. Change-Id: I4c3b482f31f638047ab3f3d785d294b28d244b80
-rwxr-xr-xsrc/osmo-gsm-tester.py5
-rw-r--r--src/osmo_gsm_tester/config.py6
2 files changed, 10 insertions, 1 deletions
diff --git a/src/osmo-gsm-tester.py b/src/osmo-gsm-tester.py
index 5854836..0402802 100755
--- a/src/osmo-gsm-tester.py
+++ b/src/osmo-gsm-tester.py
@@ -117,6 +117,9 @@ optional.''')
help='Set logging level for all categories (on stdout)')
parser.add_argument('-T', '--traceback', dest='trace', action='store_true',
help='Enable logging of tracebacks')
+ parser.add_argument('-c', '--conf-dir', dest='conf_dir',
+ help='''Specify configuration dir (overrides
+OSMO_GSM_TESTER_CONF env and default locations)''')
args = parser.parse_args()
if args.version:
@@ -135,6 +138,8 @@ optional.''')
log.set_all_levels(log.LEVEL_STRS.get(args.log_level))
if args.trace:
log.style_change(trace=True)
+ if args.conf_dir:
+ config.override_conf = args.conf_dir
combination_strs = list(args.suite_scenario or [])
# for series in args.series:
diff --git a/src/osmo_gsm_tester/config.py b/src/osmo_gsm_tester/config.py
index deb872f..38d8e2f 100644
--- a/src/osmo_gsm_tester/config.py
+++ b/src/osmo_gsm_tester/config.py
@@ -59,6 +59,8 @@ from .util import is_dict, is_list, Dir, get_tempdir
ENV_PREFIX = 'OSMO_GSM_TESTER_'
ENV_CONF = os.getenv(ENV_PREFIX + 'CONF')
+override_conf = None
+
DEFAULT_CONFIG_LOCATIONS = [
'.',
os.path.join(os.getenv('HOME'), '.config', 'osmo-gsm-tester'),
@@ -82,7 +84,9 @@ PATHS_TEMPDIR_STR = '$TEMPDIR'
PATHS = None
def _get_config_file(basename, fail_if_missing=True):
- if ENV_CONF:
+ if override_conf:
+ locations = [ override_conf ]
+ elif ENV_CONF:
locations = [ ENV_CONF ]
else:
locations = DEFAULT_CONFIG_LOCATIONS