]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
config: replace '~' by '$home' in CEPH_CONF_FILE_DEFAULT
authorRishabh Dave <ridave@redhat.com>
Mon, 12 Mar 2018 15:20:44 +0000 (20:50 +0530)
committerRishabh Dave <ridave@redhat.com>
Fri, 23 Mar 2018 05:08:09 +0000 (10:38 +0530)
And expand "$home" to get the actual path to ceph.conf.

Fixes: http://tracker.ceph.com/issues/23215
Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/common/config.cc

index b07f0a4737832b0c9f7e9506968bae9a05e92eb2..46371b82e539045ed4043502b3c5a59b647602e4 100644 (file)
@@ -42,7 +42,7 @@ using std::ostringstream;
 using std::pair;
 using std::string;
 
-static const char *CEPH_CONF_FILE_DEFAULT = "$data_dir/config, /etc/ceph/$cluster.conf, ~/.ceph/$cluster.conf, $cluster.conf"
+static const char *CEPH_CONF_FILE_DEFAULT = "$data_dir/config, /etc/ceph/$cluster.conf, $home/.ceph/$cluster.conf, $cluster.conf"
 #if defined(__FreeBSD__)
     ", /usr/local/etc/ceph/$cluster.conf"
 #endif
@@ -1156,6 +1156,9 @@ Option::value_t md_config_t::_expand_meta(
        out += stringify(getpid());
       } else if (var == "cctid") {
        out += stringify((unsigned long long)this);
+      } else if (var == "home") {
+       const char *home = getenv("HOME");
+       out = home ? std::string(home) : std::string();
       } else {
        if (var == "data_dir") {
          var = data_dir_option;