]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
configuration parsing: give better error for missing =
authorDan Mick <dan.mick@inktank.com>
Fri, 22 Feb 2013 05:41:25 +0000 (21:41 -0800)
committerDan Mick <dan.mick@inktank.com>
Fri, 22 Feb 2013 05:45:27 +0000 (21:45 -0800)
A ceph.conf line with "key" and no "= value" currently shows
"unexpected character while parsing putative key value,
at char N line M".  There's no reason it can't be clearer.

Fixes: #4229
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/common/ConfUtils.cc

index 147cdc2fb60a21bf2f9caa5fb8a08fae40018501..5efde8d4ae005231dd4d6e75975295ef2834d685 100644 (file)
@@ -471,8 +471,13 @@ process_line(int line_no, const char *line, std::deque<std::string> *errors)
       case ACCEPT_KEY:
        if ((((c == '#') || (c == ';')) && (!escaping)) || (c == '\0')) {
          ostringstream oss;
-         oss << "unexpected character while parsing putative key value, "
-             << "at char " << (l - line) << ", line " << line_no;
+         if (c == '\0') {
+           oss << "end of key=val line " << line_no
+               << " reached, no \"=val\" found...missing =?";
+         } else {
+           oss << "unexpected character while parsing putative key value, "
+               << "at char " << (l - line) << ", line " << line_no;
+         }
          errors->push_back(oss.str());
          return NULL;
        }