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
This commit is contained in:
parent
6a688d6bde
commit
f15eaf95de
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue