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.
This commit is contained in:
Andrew Mattheisen
2020-11-17 01:03:16 -06:00
committed by GitHub
parent 4f9123ebe2
commit 4430ca2317

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)