mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
provisioning: adds fallback if evalsymlink/abs fails
This commit is contained in:
parent
3f5078339c
commit
f606654c50
@ -51,7 +51,6 @@ func NewDashboardFileReader(cfg *DashboardsAsConfig, log log.Logger) (*fileReade
|
|||||||
path, err := filepath.Abs(path)
|
path, err := filepath.Abs(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Could not create absolute path ", "path", path)
|
log.Error("Could not create absolute path ", "path", path)
|
||||||
path = copy //if .Abs return an error we fallback to path
|
|
||||||
}
|
}
|
||||||
|
|
||||||
path, err = filepath.EvalSymlinks(path)
|
path, err = filepath.EvalSymlinks(path)
|
||||||
@ -59,6 +58,11 @@ func NewDashboardFileReader(cfg *DashboardsAsConfig, log log.Logger) (*fileReade
|
|||||||
log.Error("Failed to read content of symlinked path: %s", path)
|
log.Error("Failed to read content of symlinked path: %s", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if path == "" {
|
||||||
|
path = copy
|
||||||
|
log.Info("falling back to original path due to EvalSymlink/Abs failure")
|
||||||
|
}
|
||||||
|
|
||||||
return &fileReader{
|
return &fileReader{
|
||||||
Cfg: cfg,
|
Cfg: cfg,
|
||||||
Path: path,
|
Path: path,
|
||||||
|
Loading…
Reference in New Issue
Block a user