]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
conf: add --show-conf,-S option that dumps conf and exits
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 10 Mar 2009 23:26:47 +0000 (16:26 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 10 Mar 2009 23:26:47 +0000 (16:26 -0700)
src/common/ConfUtils.cc
src/config.cc
src/config.h

index bf4e550c84747683f5f4b4127448bbaaef6f9669..5fe9a67b9ed62c8dcff0c20f1a1189dbb90fd314 100644 (file)
@@ -481,9 +481,7 @@ void ConfFile::dump()
 
        sec_end=sections_list.end();
 
-       printf("------ config starts here ------\n");
        _dump(STDOUT_FILENO);
-       printf("------  config ends here  ------\n");
 }
 
 ConfSection *ConfFile::_add_section(const char *section, ConfLine *cl)
index e69b38b001dc28612f9f1a10c1536e75d31af1dc..ab3de40e8c4ce993fa4bcdb7065f18bd9118d858 100644 (file)
@@ -38,6 +38,8 @@ atomic_t buffer_total_alloc;
 
 #include "common/ConfUtils.h"
 
+static bool show_config = false;
+
 /*
 struct foobar {
   foobar() { cerr << "config.cc init" << std::endl; }
@@ -358,7 +360,6 @@ static struct config_option config_optionsp[] = {
        OPTION(global, pid_file, 'p', STR, 0),
        OPTION(global, conf, 'c', STR, INSTALL_PREFIX "/etc/ceph/ceph.conf"),
        OPTION(global, cluster_conf, 'C', STR, INSTALL_PREFIX "/etc/ceph/cluster.conf"),
-       OPTION(global, dump_conf, 0, BOOL, false),
        OPTION(global, chdir, 0, STR, "/"),
        OPTION(global, fake_clock, 0, BOOL, false),
        OPTION(global, fakemessenger_serialize, 0, BOOL, true),
@@ -762,8 +763,6 @@ void parse_startup_config_options(std::vector<const char*>& args)
        SAFE_SET_ARG_VAL(&g_conf.cluster_conf, STR);
     } else if (CMD_EQ("monmap_file", 'M')) {
        SAFE_SET_ARG_VAL(&g_conf.monmap_file, STR);
-    } else if (CMD_EQ("dump_conf", 0)) {
-       SET_BOOL_ARG_VAL(&g_conf.dump_conf);
     } else if (CMD_EQ("bind", 0)) {
       assert_warn(parse_ip_port(args[++i], g_my_addr));
     } else if (CMD_EQ("nodaemon", 'D')) {
@@ -775,6 +774,8 @@ void parse_startup_config_options(std::vector<const char*>& args)
     } else if (CMD_EQ("foreground", 'f')) {
       g_conf.daemonize = false;
       g_conf.log_to_stdout = false;
+    } else if (CMD_EQ("show_conf", 'S')) {
+      show_config = true;
     } else {
       nargs.push_back(args[i]);
     }
@@ -785,8 +786,11 @@ void parse_startup_config_options(std::vector<const char*>& args)
   ConfFile cf(g_conf.conf);
 
   parse_config_file(&cf, true);
-  if (g_conf.dump_conf)
+
+  if (show_config) {
     cf.dump();
+    exit(0);
+  }
 }
 
 void configure_daemon_mode()
index 53852d4820171414570e4dc69ca6277fc39596ad..dd47f8cada6e790cd00e855c4bcb571346322528 100644 (file)
@@ -66,7 +66,6 @@ struct md_config_t {
 
   const char *conf;
   const char *cluster_conf;
-  bool dump_conf;
 
   const char *chdir;