Commit 4430ca23 by Andrew Mattheisen Committed by GitHub

build paths in an os independent way (#29143)

Use filepath instead of path to manipulate filename paths in a way compatible with the target operating system-defined file paths.
parent 4f9123eb
...@@ -2,7 +2,7 @@ package provisioning ...@@ -2,7 +2,7 @@ package provisioning
import ( import (
"context" "context"
"path" "path/filepath"
"sync" "sync"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
...@@ -115,25 +115,25 @@ func (ps *provisioningServiceImpl) Run(ctx context.Context) error { ...@@ -115,25 +115,25 @@ func (ps *provisioningServiceImpl) Run(ctx context.Context) error {
} }
func (ps *provisioningServiceImpl) ProvisionDatasources() error { func (ps *provisioningServiceImpl) ProvisionDatasources() error {
datasourcePath := path.Join(ps.Cfg.ProvisioningPath, "datasources") datasourcePath := filepath.Join(ps.Cfg.ProvisioningPath, "datasources")
err := ps.provisionDatasources(datasourcePath) err := ps.provisionDatasources(datasourcePath)
return errutil.Wrap("Datasource provisioning error", err) return errutil.Wrap("Datasource provisioning error", err)
} }
func (ps *provisioningServiceImpl) ProvisionPlugins() error { func (ps *provisioningServiceImpl) ProvisionPlugins() error {
appPath := path.Join(ps.Cfg.ProvisioningPath, "plugins") appPath := filepath.Join(ps.Cfg.ProvisioningPath, "plugins")
err := ps.provisionPlugins(appPath) err := ps.provisionPlugins(appPath)
return errutil.Wrap("app provisioning error", err) return errutil.Wrap("app provisioning error", err)
} }
func (ps *provisioningServiceImpl) ProvisionNotifications() error { func (ps *provisioningServiceImpl) ProvisionNotifications() error {
alertNotificationsPath := path.Join(ps.Cfg.ProvisioningPath, "notifiers") alertNotificationsPath := filepath.Join(ps.Cfg.ProvisioningPath, "notifiers")
err := ps.provisionNotifiers(alertNotificationsPath) err := ps.provisionNotifiers(alertNotificationsPath)
return errutil.Wrap("Alert notification provisioning error", err) return errutil.Wrap("Alert notification provisioning error", err)
} }
func (ps *provisioningServiceImpl) ProvisionDashboards() error { func (ps *provisioningServiceImpl) ProvisionDashboards() error {
dashboardPath := path.Join(ps.Cfg.ProvisioningPath, "dashboards") dashboardPath := filepath.Join(ps.Cfg.ProvisioningPath, "dashboards")
dashProvisioner, err := ps.newDashboardProvisioner(dashboardPath) dashProvisioner, err := ps.newDashboardProvisioner(dashboardPath)
if err != nil { if err != nil {
return errutil.Wrap("Failed to create provisioner", err) return errutil.Wrap("Failed to create provisioner", err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment