]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
config: warn about old-style conf section names
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 15 Apr 2011 22:21:36 +0000 (15:21 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 15 Apr 2011 22:29:22 +0000 (15:29 -0700)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/common/config.cc

index 2379aaba3f8279cb99d731854dd41619b922e1db..f8cc5667975c88884bb195a6ccb159844e99543f 100644 (file)
@@ -489,6 +489,29 @@ parse_config_files(const std::list<std::string> &conf_files,
   g_lockdep =
     ((get_val_from_conf_file(my_sections, "lockdep", val, true) == 0) &&
       ((strcasecmp(val.c_str(), "true") == 0) || (atoi(val.c_str()) != 0)));
+
+  // Warn about section names that look like old-style section names
+  std::deque < std::string > old_style_section_names;
+  for (ConfFile::const_section_iter_t s = cf.sections_begin();
+       s != cf.sections_end(); ++s) {
+    const string &str(s->first);
+    if (((str.find("mds") == 0) || (str.find("mon") == 0) ||
+        (str.find("osd") == 0)) && (str.size() > 3) && (str[3] != '.')) {
+      old_style_section_names.push_back(str);
+    }
+  }
+  if (!old_style_section_names.empty()) {
+    ostringstream oss;
+    oss << "ERROR! old-style section name(s) found: ";
+    string sep;
+    for (std::deque < std::string >::const_iterator os = old_style_section_names.begin();
+        os != old_style_section_names.end(); ++os) {
+      oss << sep << *os;
+      sep = ", ";
+    }
+    oss << ". Please use the new style section names that include a period.";
+    parse_errors->push_back(oss.str());
+  }
   return 0;
 }