From f23ff731ed434829f4208232e180b2765b675542 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Fri, 10 Oct 2014 16:58:50 -0700 Subject: [PATCH] ceph-osdomap-tool: Fix argument handling Signed-off-by: David Zafman --- src/tools/ceph_osdomap_tool.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/tools/ceph_osdomap_tool.cc b/src/tools/ceph_osdomap_tool.cc index 56c18ae7c8bd3..676723bf8abd6 100644 --- a/src/tools/ceph_osdomap_tool.cc +++ b/src/tools/ceph_osdomap_tool.cc @@ -28,15 +28,13 @@ using namespace std; int main(int argc, char **argv) { po::options_description desc("Allowed options"); string store_path, cmd, out_path; - bool paranoid = false; desc.add_options() ("help", "produce help message") ("omap-path", po::value(&store_path), "path to mon directory, mandatory (current/omap usually)") - ("paranoid", po::value(¶noid), - "use paranoid checking") + ("paranoid", "use paranoid checking") ("command", po::value(&cmd), - "command") + "command arg is one of [dump-raw-keys, dump-raw-key-vals, dump-objects, dump-objects-with-keys, check], mandatory") ; po::positional_options_description p; p.add("command", 1); @@ -78,10 +76,20 @@ int main(int argc, char **argv) { return 1; } + if (vm.count("omap-path") == 0) { + std::cerr << "Required argument --omap-path" << std::endl; + return 1; + } + + if (vm.count("command") == 0) { + std::cerr << "Required argument --command" << std::endl; + return 1; + } + LevelDBStore* store(new LevelDBStore(g_ceph_context, store_path)); - if (paranoid) { + if (vm.count("paranoid")) { std::cerr << "Enabling paranoid checks" << std::endl; - store->options.paranoid_checks = paranoid; + store->options.paranoid_checks = true; } DBObjectMap omap(store); stringstream out; -- 2.39.5