]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/ConfigMonitor: do not indent 'config dump' output 40556/head
authorSage Weil <sage@newdream.net>
Thu, 1 Apr 2021 19:22:07 +0000 (14:22 -0500)
committerSage Weil <sage@newdream.net>
Thu, 1 Apr 2021 19:22:07 +0000 (14:22 -0500)
The indentation is misleading.  For example,

  mgr                                  advanced  mgr/telemetry/last_opt_revision       3                                                                                  *
  osd                                  advanced  osd_max_backfills                     10
  osd                                  basic     osd_memory_target                     6442450944
  osd                                  advanced  osd_scrub_auto_repair                 true
    mds.ar                             basic     mds_join_fs                           ar
    client.rgw.foo                     basic     rgw_frontends                         beast port=8080                                                                    *

The indentation kind of implies that mds.ar (or client.whatever) is
beneath 'osd', which it is not, and there rarely a 'client' scoped
option to make it look right.  Same problem for osd.foo etc.

Also, it is IMO easier to see the nesting structure when things align
naturally. e.g.

global
osd
osd.1
osd.2
mds
mds.foo
mds.foo.bar
client.foo.bar
...

Signed-off-by: Sage Weil <sage@newdream.net>
src/mon/ConfigMonitor.cc

index 7f0ee21e67155f723c6f28f479581c10897d636e..f34dd0ecb2f2364d7ae2f91b684228d12ca6f739 100644 (file)
@@ -168,17 +168,6 @@ bool ConfigMonitor::preprocess_query(MonOpRequestRef op)
   return false;
 }
 
-static string indent_who(const string& who)
-{
-  if (who == "global") {
-    return who;
-  }
-  if (who.find('.') == string::npos) {
-    return "  " + who;
-  }
-  return "    " + who;
-}
-
 bool ConfigMonitor::preprocess_command(MonOpRequestRef op)
 {
   auto m = op->get_req<MMonCommand>();
@@ -278,7 +267,7 @@ bool ConfigMonitor::preprocess_command(MonOpRequestRef op)
     for (auto s : sections) {
       for (auto& i : s.second->options) {
        if (!f) {
-         tbl << indent_who(s.first);
+         tbl << s.first;
          tbl << i.second.mask.to_str();
          tbl << Option::level_to_str(i.second.opt->level);
           tbl << i.first;