]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
global_init: don't fail out if there is no default config.
authorGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 30 Apr 2012 22:06:17 +0000 (15:06 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 30 Apr 2012 22:06:17 +0000 (15:06 -0700)
There are plenty of scenarios where the user doesn't need a config file.
Instead, just print a warning and let things move on.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/global/global_init.cc
src/test/cli/ceph-conf/env-vs-args.t

index 84644a6d91b69c3db80b421c6c4937df4b2f4dac..a977fbe2bc1844499e823a3d6543ca2c25c34990 100644 (file)
@@ -81,8 +81,12 @@ 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)) {
-      dout_emergency("global_init: unable to open config file.\n");
-      _exit(1);
+      if (conf_file_list.length()) {
+        dout_emergency("global_init: unable to open config file.\n");
+        _exit(1);
+      } else {
+        derr <<"did not load config file, using default settings." << dendl;
+      }
     }
   }
   else if (ret) {
@@ -100,7 +104,9 @@ void global_init(std::vector < const char * > *alt_def_args, std::vector < const
   g_lockdep = cct->_conf->lockdep;
 
   // Now we're ready to complain about config file parse errors
-  complain_about_parse_errors(cct, &parse_errors);
+  if (conf_file_list.length()) {
+    complain_about_parse_errors(cct, &parse_errors);
+  }
 
   // signal stuff
   int siglist[] = { SIGPIPE, 0 };
index 193e40c2d60998474abbef48fa080cabbed29e6f..7eefd98b79343594b1c19884bccf5b3fe208d2d0 100644 (file)
@@ -1,6 +1,6 @@
 # we can use CEPH_CONF to override the normal configuration file location.
   $ env CEPH_CONF=from-env ceph-conf -s foo bar
-  global_init: unable to open config file. (re)
+  .* \-1 did not load config file, using default settings. (re)
   [1]
 
 # command-line arguments should override environment