diff options
author | Sage Weil <sage@inktank.com> | 2012-12-10 16:41:19 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-12-10 16:41:19 -0800 |
commit | a50c7d3b2f9eaca53a96f7942eaa203a849b3317 (patch) | |
tree | 591d559448091b9b2e8e64161ce345c534b06dd1 | |
parent | 6fb9a5580e59d26843971851b1503dc4bde6542c (diff) | |
download | ceph-a50c7d3b2f9eaca53a96f7942eaa203a849b3317.tar.gz |
config: do not always print config file missing errors
Do not generate errors each time we fail to open a config file; only
generate one at the end if a search path was specified and none were
usable, right before we (already) exit. This avoids spamming stderr
about each path we tried in the search list before we found a good one.
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/common/ConfUtils.cc | 3 | ||||
-rw-r--r-- | src/global/global_init.cc | 5 | ||||
-rw-r--r-- | src/test/cli/ceph-conf/env-vs-args.t | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/common/ConfUtils.cc b/src/common/ConfUtils.cc index a9e5d7a42f5..147cdc2fb60 100644 --- a/src/common/ConfUtils.cc +++ b/src/common/ConfUtils.cc @@ -101,9 +101,6 @@ parse_file(const std::string &fname, std::deque<std::string> *errors, FILE *fp = fopen(fname.c_str(), "r"); if (!fp) { ret = -errno; - ostringstream oss; - oss << "read_conf: failed to open '" << fname << "': " << cpp_strerror(ret); - errors->push_back(oss.str()); return ret; } diff --git a/src/global/global_init.cc b/src/global/global_init.cc index 0182fb0ccaa..43ce0909565 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -82,7 +82,10 @@ void global_init(std::vector < const char * > *alt_def_args, std::vector < const else if (ret == -EINVAL) { if (!(flags & CINIT_FLAG_NO_DEFAULT_CONFIG_FILE)) { if (conf_file_list.length()) { - dout_emergency("global_init: unable to open config file.\n"); + ostringstream oss; + oss << "global_init: unable to open config file from search list " + << conf_file_list << "\n"; + dout_emergency(oss.str()); _exit(1); } else { derr <<"did not load config file, using default settings." << dendl; diff --git a/src/test/cli/ceph-conf/env-vs-args.t b/src/test/cli/ceph-conf/env-vs-args.t index 7eefd98b793..76b2dec9cfb 100644 --- a/src/test/cli/ceph-conf/env-vs-args.t +++ b/src/test/cli/ceph-conf/env-vs-args.t @@ -5,6 +5,6 @@ # command-line arguments should override environment $ env -u CEPH_CONF ceph-conf -c from-args - global_init: unable to open config file. (re) + global_init: unable to open config file from search list from-args [1] |