build paths in an os independent way (#29143) (#29147)

Use filepath instead of path to manipulate filename paths in a way compatible with the target operating system-defined file paths.

(cherry picked from commit 4430ca2317)

Co-authored-by: Andrew Mattheisen <amattheisen@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2020-11-17 08:24:12 +01:00
committed by GitHub
co-authored by Andrew Mattheisen
parent 7e6c34fc20
commit f04131c9c6
+5 -5
View File
@@ -2,7 +2,7 @@ package provisioning
import (
"context"
"path"
"path/filepath"
"sync"
"github.com/grafana/grafana/pkg/infra/log"
@@ -115,25 +115,25 @@ func (ps *provisioningServiceImpl) Run(ctx context.Context) error {
}
func (ps *provisioningServiceImpl) ProvisionDatasources() error {
datasourcePath := path.Join(ps.Cfg.ProvisioningPath, "datasources")
datasourcePath := filepath.Join(ps.Cfg.ProvisioningPath, "datasources")
err := ps.provisionDatasources(datasourcePath)
return errutil.Wrap("Datasource provisioning error", err)
}
func (ps *provisioningServiceImpl) ProvisionPlugins() error {
appPath := path.Join(ps.Cfg.ProvisioningPath, "plugins")
appPath := filepath.Join(ps.Cfg.ProvisioningPath, "plugins")
err := ps.provisionPlugins(appPath)
return errutil.Wrap("app provisioning error", err)
}
func (ps *provisioningServiceImpl) ProvisionNotifications() error {
alertNotificationsPath := path.Join(ps.Cfg.ProvisioningPath, "notifiers")
alertNotificationsPath := filepath.Join(ps.Cfg.ProvisioningPath, "notifiers")
err := ps.provisionNotifiers(alertNotificationsPath)
return errutil.Wrap("Alert notification provisioning error", err)
}
func (ps *provisioningServiceImpl) ProvisionDashboards() error {
dashboardPath := path.Join(ps.Cfg.ProvisioningPath, "dashboards")
dashboardPath := filepath.Join(ps.Cfg.ProvisioningPath, "dashboards")
dashProvisioner, err := ps.newDashboardProvisioner(dashboardPath)
if err != nil {
return errutil.Wrap("Failed to create provisioner", err)