From 886c7d35c0d83536b7bff564d177ec950ed4f228 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Fri, 14 Jan 2011 17:18:48 -0800 Subject: [PATCH] Command line -c should still override CEPH_CONF from env. --- src/config.cc | 3 ++- src/test/cli/cconf/env-vs-args.t | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/test/cli/cconf/env-vs-args.t diff --git a/src/config.cc b/src/config.cc index 5c9b675dd8432..67614ad1025c3 100644 --- a/src/config.cc +++ b/src/config.cc @@ -1229,7 +1229,8 @@ void parse_startup_config_options(std::vector& args, const char *mo } } - env_override(&g_conf.conf, "CEPH_CONF"); + if (!conf_specified) + env_override(&g_conf.conf, "CEPH_CONF"); // open new conf string fn = g_conf.conf; diff --git a/src/test/cli/cconf/env-vs-args.t b/src/test/cli/cconf/env-vs-args.t new file mode 100644 index 0000000000000..d7e88ee1e99cd --- /dev/null +++ b/src/test/cli/cconf/env-vs-args.t @@ -0,0 +1,11 @@ +# we can use CEPH_CONF to decide what config to read; this doesn't +# output the same error as below because with just the environment, +# the config is not considered explicitly specified + $ env CEPH_CONF=from-env cconf -s foo bar + [2] + +# command-line arguments should override environment + $ env -u CEPH_CONF cconf -c from-args + error reading config file(s) from-args + [1] + -- 2.39.5