]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/admin_socket: do not populate empty help strings
authorSage Weil <sage@inktank.com>
Sat, 27 Jul 2013 05:08:26 +0000 (22:08 -0700)
committerSage Weil <sage@inktank.com>
Sat, 27 Jul 2013 05:08:26 +0000 (22:08 -0700)
Hidden commands have no help string.  Make this consistent: the m_help
entry is always there, but may be empty.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/admin_socket.cc

index 4afd685b72acd0c4d47077bc057f9258eb003333..e73f3ce0a0c2a5b8bb26b8a3a0997053dea06c68 100644 (file)
@@ -390,8 +390,7 @@ int AdminSocket::register_command(std::string command, std::string cmddesc, Admi
     ldout(m_cct, 5) << "register_command " << command << " hook " << hook << dendl;
     m_hooks[command] = hook;
     m_descs[command] = cmddesc;
-    if (help.length())
-      m_help[command] = help;
+    m_help[command] = help;
     ret = 0;
   }  
   m_lock.Unlock();
@@ -448,7 +447,8 @@ public:
     for (map<string,string>::iterator p = m_as->m_help.begin();
         p != m_as->m_help.end();
         ++p) {
-      f->dump_string(p->first.c_str(), p->second);
+      if (p->second.length())
+       f->dump_string(p->first.c_str(), p->second);
     }
     f->close_section();
     ostringstream ss;