You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@htrace.apache.org by cm...@apache.org on 2015/07/30 20:18:36 UTC
incubator-htrace git commit: HTRACE-221. htraced: search
/etc/htraced/conf for the htraced configuration by default (cmccabe)
Repository: incubator-htrace
Updated Branches:
refs/heads/master 0ddc3ea16 -> 708b3e897
HTRACE-221. htraced: search /etc/htraced/conf for the htraced configuration by default (cmccabe)
Project: http://git-wip-us.apache.org/repos/asf/incubator-htrace/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-htrace/commit/708b3e89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-htrace/tree/708b3e89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-htrace/diff/708b3e89
Branch: refs/heads/master
Commit: 708b3e897a569633ff6da26242e98fcb47b5983f
Parents: 0ddc3ea
Author: Colin Patrick Mccabe <cm...@cloudera.com>
Authored: Thu Jul 30 11:16:00 2015 -0700
Committer: Colin Patrick Mccabe <cm...@cloudera.com>
Committed: Thu Jul 30 11:16:00 2015 -0700
----------------------------------------------------------------------
htrace-htraced/go/src/org/apache/htrace/conf/config.go | 10 ++++++++--
.../go/src/org/apache/htrace/conf/config_test.go | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/708b3e89/htrace-htraced/go/src/org/apache/htrace/conf/config.go
----------------------------------------------------------------------
diff --git a/htrace-htraced/go/src/org/apache/htrace/conf/config.go b/htrace-htraced/go/src/org/apache/htrace/conf/config.go
index 6093649..3302f4d 100644
--- a/htrace-htraced/go/src/org/apache/htrace/conf/config.go
+++ b/htrace-htraced/go/src/org/apache/htrace/conf/config.go
@@ -68,13 +68,19 @@ type Builder struct {
Argv []string
}
+func getDefaultHTracedConfDir() string {
+ return PATH_SEP + "etc" + PATH_SEP + "htraced" + PATH_SEP + "conf";
+}
+
func getHTracedConfDirs(dlog io.Writer) []string {
confDir := os.Getenv("HTRACED_CONF_DIR")
- io.WriteString(dlog, fmt.Sprintf("HTRACED_CONF_DIR=%s\n", confDir))
paths := filepath.SplitList(confDir)
if len(paths) < 1 {
- return []string{"."}
+ def := getDefaultHTracedConfDir()
+ io.WriteString(dlog, fmt.Sprintf("HTRACED_CONF_DIR defaulting to %s\n", def))
+ return []string{ def }
}
+ io.WriteString(dlog, fmt.Sprintf("HTRACED_CONF_DIR=%s\n", confDir))
return paths
}
http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/708b3e89/htrace-htraced/go/src/org/apache/htrace/conf/config_test.go
----------------------------------------------------------------------
diff --git a/htrace-htraced/go/src/org/apache/htrace/conf/config_test.go b/htrace-htraced/go/src/org/apache/htrace/conf/config_test.go
index 42c1c71..d3509b0 100644
--- a/htrace-htraced/go/src/org/apache/htrace/conf/config_test.go
+++ b/htrace-htraced/go/src/org/apache/htrace/conf/config_test.go
@@ -127,7 +127,7 @@ func TestGetHTracedConfDirs(t *testing.T) {
os.Setenv("HTRACED_CONF_DIR", "")
dlog := new(bytes.Buffer)
dirs := getHTracedConfDirs(dlog)
- if len(dirs) != 1 || dirs[0] != "." {
+ if len(dirs) != 1 || dirs[0] != getDefaultHTracedConfDir() {
t.Fatal()
}
os.Setenv("HTRACED_CONF_DIR", "/foo/bar:/baz")