From 7a913f77d31126ed0dc05ca90faa69c625ceafdc Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 15 Aug 2016 08:54:35 +0200 Subject: [PATCH 1/5] feat(cli): add default plugin folder for MAC OS closes #5806 --- pkg/cmd/grafana-cli/main.go | 32 +--------------- pkg/cmd/grafana-cli/utils/grafana_path.go | 46 +++++++++++++++++++++++ 2 files changed, 48 insertions(+), 30 deletions(-) create mode 100644 pkg/cmd/grafana-cli/utils/grafana_path.go diff --git a/pkg/cmd/grafana-cli/main.go b/pkg/cmd/grafana-cli/main.go index 131d9189022..fbdec792322 100644 --- a/pkg/cmd/grafana-cli/main.go +++ b/pkg/cmd/grafana-cli/main.go @@ -8,39 +8,11 @@ import ( "github.com/codegangsta/cli" "github.com/grafana/grafana/pkg/cmd/grafana-cli/commands" "github.com/grafana/grafana/pkg/cmd/grafana-cli/logger" + "github.com/grafana/grafana/pkg/cmd/grafana-cli/utils" ) var version = "master" -func getGrafanaPluginDir() string { - currentOS := runtime.GOOS - defaultNix := "/var/lib/grafana/plugins" - - if currentOS == "windows" { - return "../data/plugins" - } - - pwd, err := os.Getwd() - - if err != nil { - logger.Error("Could not get current path. using default") - return defaultNix - } - - if isDevenvironment(pwd) { - return "../data/plugins" - } - - return defaultNix -} - -func isDevenvironment(pwd string) bool { - // if ../conf/defaults.ini exists, grafana is not installed as package - // that its in development environment. - _, err := os.Stat("../conf/defaults.ini") - return err == nil -} - func main() { setupLogging() @@ -54,7 +26,7 @@ func main() { cli.StringFlag{ Name: "pluginsDir", Usage: "path to the grafana plugin directory", - Value: getGrafanaPluginDir(), + Value: utils.GetGrafanaPluginDir(runtime.GOOS), EnvVar: "GF_PLUGIN_DIR", }, cli.StringFlag{ diff --git a/pkg/cmd/grafana-cli/utils/grafana_path.go b/pkg/cmd/grafana-cli/utils/grafana_path.go new file mode 100644 index 00000000000..fa6dc46d783 --- /dev/null +++ b/pkg/cmd/grafana-cli/utils/grafana_path.go @@ -0,0 +1,46 @@ +package utils + +import ( + "os" + + "github.com/grafana/grafana/pkg/cmd/grafana-cli/logger" +) + +func GetGrafanaPluginDir(currentOS string) string { + //currentOS := runtime.GOOS + + if currentOS == "windows" { + return returnOsDefault(currentOS) + } + + pwd, err := os.Getwd() + + if err != nil { + logger.Error("Could not get current path. using default") + return returnOsDefault(currentOS) + } + + if isDevenvironment(pwd) { + return "../data/plugins" + } + + return returnOsDefault(currentOS) +} + +func isDevenvironment(pwd string) bool { + // if ../conf/defaults.ini exists, grafana is not installed as package + // that its in development environment. + _, err := os.Stat("../conf/defaults.ini") + return err == nil +} + +func returnOsDefault(currentOs string) string { + switch currentOs { + case "windows": + return "../data/plugins" + case "darwin": + return "/usr/local/var/lib/grafana/plugins" + default: //"linux" + return "/var/lib/grafana/plugins" + } +} From 7ce13ef0754e3fe8a25364e9fa2fc68ea2276615 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 15 Aug 2016 09:13:49 +0200 Subject: [PATCH 2/5] docs(changelog): add note about fixing #5806 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 083de33599e..199221cd4a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * **Templating**: Fixed issue when combining row & panel repeats, fixes [#5790](https://github.com/grafana/grafana/issues/5790) * **Drag&Drop**: Fixed issue with drag and drop in latest Chrome(51+), fixes [#5767](https://github.com/grafana/grafana/issues/5767) * **Internal Metrics**: Fixed issue with dots in instance_name when sending internal metrics to Graphitge, fixes [#5739](https://github.com/grafana/grafana/issues/5739) +* **Grafana-CLI**: Add default plugin path for MAC OS, fixes [#5806](https://github.com/grafana/grafana/issues/5806) # 3.1.1 (2016-08-01) * **IFrame embedding**: Fixed issue of using full iframe height, fixes [#5605](https://github.com/grafana/grafana/issues/5606) From cd9bd5be17438c20a89485530c802a091fdf269c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 15 Aug 2016 09:15:20 +0200 Subject: [PATCH 3/5] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 199221cd4a1..79d0057870b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ # 3.1.2 (unreleased) * **Templating**: Fixed issue when combining row & panel repeats, fixes [#5790](https://github.com/grafana/grafana/issues/5790) * **Drag&Drop**: Fixed issue with drag and drop in latest Chrome(51+), fixes [#5767](https://github.com/grafana/grafana/issues/5767) -* **Internal Metrics**: Fixed issue with dots in instance_name when sending internal metrics to Graphitge, fixes [#5739](https://github.com/grafana/grafana/issues/5739) +* **Internal Metrics**: Fixed issue with dots in instance_name when sending internal metrics to Graphite, fixes [#5739](https://github.com/grafana/grafana/issues/5739) * **Grafana-CLI**: Add default plugin path for MAC OS, fixes [#5806](https://github.com/grafana/grafana/issues/5806) # 3.1.1 (2016-08-01) From 08932b8ebc972658cbec09b0e7e5e8568697d4b4 Mon Sep 17 00:00:00 2001 From: Claudius Zingerli Date: Mon, 15 Aug 2016 17:56:46 +0200 Subject: [PATCH 4/5] InfluxDB data source: Removed 'required' attribute from User/Password (#5820) --- public/app/plugins/datasource/influxdb/partials/config.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/partials/config.html b/public/app/plugins/datasource/influxdb/partials/config.html index 8c09c637906..27b28ba59de 100644 --- a/public/app/plugins/datasource/influxdb/partials/config.html +++ b/public/app/plugins/datasource/influxdb/partials/config.html @@ -14,11 +14,11 @@
User - +
Password - +
From de714e339836c40549870368de7311c8dc5b3b2f Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 16 Aug 2016 15:54:13 +0200 Subject: [PATCH 5/5] tech(docker): add default db for postgres --- docker/blocks/postgres/fig | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/blocks/postgres/fig b/docker/blocks/postgres/fig index c7458cbe400..33499688810 100644 --- a/docker/blocks/postgres/fig +++ b/docker/blocks/postgres/fig @@ -3,5 +3,6 @@ postgrestest: environment: POSTGRES_USER: grafana POSTGRES_PASSWORD: password + POSTGRES_DATABASE: grafana ports: - "5432:5432"