]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
config: do not always print config file missing errors
authorSage Weil <sage@inktank.com>
Tue, 11 Dec 2012 00:41:19 +0000 (16:41 -0800)
committerSage Weil <sage@inktank.com>
Tue, 11 Dec 2012 00:41:19 +0000 (16:41 -0800)
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>
src/common/ConfUtils.cc
src/global/global_init.cc
src/test/cli/ceph-conf/env-vs-args.t

index a9e5d7a42f54b39f4348e0517161e4ea58fbb719..147cdc2fb60a21bf2f9caa5fb8a08fae40018501 100644 (file)
@@ -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;
   }
 
index 0182fb0ccaaf5e6dc97a2f7cd16600a9f900526d..43ce09095651aa80e2f203a0e20ec23c70eb1c99 100644 (file)
@@ -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;
index 7eefd98b79343594b1c19884bccf5b3fe208d2d0..76b2dec9cfb850a3d60de3e19e5da3ce4eebcf22 100644 (file)
@@ -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]