From: Ondrej Lichtner olichtne@redhat.com
Sometimes we want to ignore automatically loaded config files and just force use a specific file. I added a new option for this '-C' that reloads the Controller Config defaults and then loads the specified config file. It's possible to use the option multiple times (each time will reset the defaults) and it's also possible to use the '-c' option after using '-C'.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst-ctl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/lnst-ctl b/lnst-ctl index 5ec08b5..42aad02 100755 --- a/lnst-ctl +++ b/lnst-ctl @@ -44,6 +44,8 @@ def usage(retval=0): "will override any other definitions in the recipe" print " -a, --define-alias name=value define top-level alias" print " -c, --config=FILE load additional config file" + print " -C, --config-override=FILE reset config defaults and load " \ + "the following config file" print " -d, --debug emit debugging messages" print " --dump-config dumps the join of all loaded " \ "configuration files on stdout and exits" @@ -238,11 +240,12 @@ def main(): try: opts, args = getopt.getopt( sys.argv[1:], - "A:a:c:dhmoprs:t:ux:v", + "A:a:c:C:dhmoprs:t:ux:v", [ "override_alias=", "define_alias=", "config=", + "config-override=", "debug", "dump-config", "help", @@ -308,6 +311,14 @@ def main(): usage(RETVAL_ERR) else: lnst_config.load_config(arg) + elif opt in ("-C", "--config-override"): + if not os.path.isfile(arg): + print "File '%s' doesn't exist!" % arg + usage(RETVAL_ERR) + else: + print >> sys.stderr, "Reloading config defaults!" + lnst_config.controller_init() + lnst_config.load_config(arg) elif opt in ("-x", "--result"): result_path = arg elif opt in ("-t", "--html"):
From: Ondrej Lichtner olichtne@redhat.com
When lnst regression tests are not using user configuration they should load just the config file provided by the env/ directory. To do this we use the new -C lnst-ctl option.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- regression-tests/run-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/regression-tests/run-test.sh b/regression-tests/run-test.sh index fba47ca..02fa126 100755 --- a/regression-tests/run-test.sh +++ b/regression-tests/run-test.sh @@ -61,7 +61,7 @@ function get_pool_dirs if [ "$use_user_conf" = "true" ]; then command lnst-ctl --dump-pools 2>/dev/null | cut -d = -f2 else - command lnst-ctl -c $repo/lnst-ctl.conf --dump-pools 2>/dev/null | + command lnst-ctl -C $repo/lnst-ctl.conf --dump-pools 2>/dev/null | cut -d = -f2 fi }
Mon, May 30, 2016 at 09:33:56AM CEST, olichtne@redhat.com wrote:
From: Ondrej Lichtner olichtne@redhat.com
Sometimes we want to ignore automatically loaded config files and just force use a specific file. I added a new option for this '-C' that reloads the Controller Config defaults and then loads the specified config file. It's possible to use the option multiple times (each time will reset the defaults) and it's also possible to use the '-c' option after using '-C'.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com
Acked-by: Jan Tluka jtluka@redhat.com
lnst-developers@lists.fedorahosted.org