Skip to content

Commit 2b2b648

Browse files
committed
Merge branch 'master' of github.com:grafana/grafana
2 parents 159ea69 + de714e3 commit 2b2b648

File tree

5 files changed

+53
-33
lines changed

5 files changed

+53
-33
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
# 3.1.2 (unreleased)
1111
* **Templating**: Fixed issue when combining row & panel repeats, fixes [#5790](https://github.com/grafana/grafana/issues/5790)
1212
* **Drag&Drop**: Fixed issue with drag and drop in latest Chrome(51+), fixes [#5767](https://github.com/grafana/grafana/issues/5767)
13-
* **Internal Metrics**: Fixed issue with dots in instance_name when sending internal metrics to Graphitge, fixes [#5739](https://github.com/grafana/grafana/issues/5739)
13+
* **Internal Metrics**: Fixed issue with dots in instance_name when sending internal metrics to Graphite, fixes [#5739](https://github.com/grafana/grafana/issues/5739)
14+
* **Grafana-CLI**: Add default plugin path for MAC OS, fixes [#5806](https://github.com/grafana/grafana/issues/5806)
1415

1516
# 3.1.1 (2016-08-01)
1617
* **IFrame embedding**: Fixed issue of using full iframe height, fixes [#5605](https://github.com/grafana/grafana/issues/5606)

docker/blocks/postgres/fig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ postgrestest:
33
environment:
44
POSTGRES_USER: grafana
55
POSTGRES_PASSWORD: password
6+
POSTGRES_DATABASE: grafana
67
ports:
78
- "5432:5432"

pkg/cmd/grafana-cli/main.go

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,11 @@ import (
88
"github.com/codegangsta/cli"
99
"github.com/grafana/grafana/pkg/cmd/grafana-cli/commands"
1010
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
11+
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
1112
)
1213

1314
var version = "master"
1415

15-
func getGrafanaPluginDir() string {
16-
currentOS := runtime.GOOS
17-
defaultNix := "/var/lib/grafana/plugins"
18-
19-
if currentOS == "windows" {
20-
return "../data/plugins"
21-
}
22-
23-
pwd, err := os.Getwd()
24-
25-
if err != nil {
26-
logger.Error("Could not get current path. using default")
27-
return defaultNix
28-
}
29-
30-
if isDevenvironment(pwd) {
31-
return "../data/plugins"
32-
}
33-
34-
return defaultNix
35-
}
36-
37-
func isDevenvironment(pwd string) bool {
38-
// if ../conf/defaults.ini exists, grafana is not installed as package
39-
// that its in development environment.
40-
_, err := os.Stat("../conf/defaults.ini")
41-
return err == nil
42-
}
43-
4416
func main() {
4517
setupLogging()
4618

@@ -54,7 +26,7 @@ func main() {
5426
cli.StringFlag{
5527
Name: "pluginsDir",
5628
Usage: "path to the grafana plugin directory",
57-
Value: getGrafanaPluginDir(),
29+
Value: utils.GetGrafanaPluginDir(runtime.GOOS),
5830
EnvVar: "GF_PLUGIN_DIR",
5931
},
6032
cli.StringFlag{
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package utils
2+
3+
import (
4+
"os"
5+
6+
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
7+
)
8+
9+
func GetGrafanaPluginDir(currentOS string) string {
10+
//currentOS := runtime.GOOS
11+
12+
if currentOS == "windows" {
13+
return returnOsDefault(currentOS)
14+
}
15+
16+
pwd, err := os.Getwd()
17+
18+
if err != nil {
19+
logger.Error("Could not get current path. using default")
20+
return returnOsDefault(currentOS)
21+
}
22+
23+
if isDevenvironment(pwd) {
24+
return "../data/plugins"
25+
}
26+
27+
return returnOsDefault(currentOS)
28+
}
29+
30+
func isDevenvironment(pwd string) bool {
31+
// if ../conf/defaults.ini exists, grafana is not installed as package
32+
// that its in development environment.
33+
_, err := os.Stat("../conf/defaults.ini")
34+
return err == nil
35+
}
36+
37+
func returnOsDefault(currentOs string) string {
38+
switch currentOs {
39+
case "windows":
40+
return "../data/plugins"
41+
case "darwin":
42+
return "/usr/local/var/lib/grafana/plugins"
43+
default: //"linux"
44+
return "/var/lib/grafana/plugins"
45+
}
46+
}

public/app/plugins/datasource/influxdb/partials/config.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ <h3 class="page-heading">InfluxDB Details</h3>
1414
<div class="gf-form-inline">
1515
<div class="gf-form max-width-15">
1616
<span class="gf-form-label width-7">User</span>
17-
<input type="text" class="gf-form-input" ng-model='ctrl.current.user' placeholder="" required></input>
17+
<input type="text" class="gf-form-input" ng-model='ctrl.current.user' placeholder=""></input>
1818
</div>
1919
<div class="gf-form max-width-15">
2020
<span class="gf-form-label width-7">Password</span>
21-
<input type="password" class="gf-form-input" ng-model='ctrl.current.password' placeholder="" required></input>
21+
<input type="password" class="gf-form-input" ng-model='ctrl.current.password' placeholder=""></input>
2222
</div>
2323
</div>
2424
</div>

0 commit comments

Comments
 (0)