From 12a1813243ec297abc812e39f4a65b8c4261076b Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 10 Mar 2009 16:26:47 -0700 Subject: [PATCH] conf: add --show-conf,-S option that dumps conf and exits --- src/common/ConfUtils.cc | 2 -- src/config.cc | 12 ++++++++---- src/config.h | 1 - 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/common/ConfUtils.cc b/src/common/ConfUtils.cc index bf4e550c84747..5fe9a67b9ed62 100644 --- a/src/common/ConfUtils.cc +++ b/src/common/ConfUtils.cc @@ -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) diff --git a/src/config.cc b/src/config.cc index e69b38b001dc2..ab3de40e8c4ce 100644 --- a/src/config.cc +++ b/src/config.cc @@ -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& 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& 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& 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() diff --git a/src/config.h b/src/config.h index 53852d4820171..dd47f8cada6e7 100644 --- a/src/config.h +++ b/src/config.h @@ -66,7 +66,6 @@ struct md_config_t { const char *conf; const char *cluster_conf; - bool dump_conf; const char *chdir; -- 2.39.5