]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/config: expand $data_dir in config path
authorSage Weil <sage@redhat.com>
Tue, 26 Jan 2016 21:06:20 +0000 (16:06 -0500)
committerSage Weil <sage@redhat.com>
Thu, 4 Feb 2016 22:06:02 +0000 (17:06 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config.cc

index 27858a258a37cc87faf50e844c7205abd528807d..7ffaf0494b0eb50eaecfc6df091ae5c71514cc53 100644 (file)
@@ -217,8 +217,25 @@ int md_config_t::parse_config_files(const char *conf_files,
       conf_files = CEPH_CONF_FILE_DEFAULT;
     }
   }
+
   std::list<std::string> cfl;
   get_str_list(conf_files, cfl);
+  auto p = cfl.begin();
+  while (p != cfl.end()) {
+    // expand $data_dir?
+    string &s = *p;
+    if (s.find("$data_dir") != string::npos) {
+      if (data_dir_option.length()) {
+       list<config_option*> stack;
+       expand_meta(s, NULL, stack, warnings);
+       p++;
+      } else {
+       cfl.erase(p++);  // ignore this item
+      }
+    } else {
+      ++p;
+    }
+  }
   return parse_config_files_impl(cfl, parse_errors, warnings);
 }