Commit d089b5e0 by bergquist

provisioning: turn relative symlinked path into absolut paths

parent f606654c
...@@ -48,16 +48,25 @@ func NewDashboardFileReader(cfg *DashboardsAsConfig, log log.Logger) (*fileReade ...@@ -48,16 +48,25 @@ func NewDashboardFileReader(cfg *DashboardsAsConfig, log log.Logger) (*fileReade
} }
copy := path copy := path
// get absolut path of config file
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)
} }
// follow the symlink to get the real path
path, err = filepath.EvalSymlinks(path) path, err = filepath.EvalSymlinks(path)
if err != nil { if err != nil {
log.Error("Failed to read content of symlinked path: %s", path) log.Error("Failed to read content of symlinked path: %s", path)
} }
// get the absolut path in case the symlink is relative
path, err = filepath.Abs(path)
if err != nil {
log.Error("Could not create absolute path ", "path", path)
}
if path == "" { if path == "" {
path = copy path = copy
log.Info("falling back to original path due to EvalSymlink/Abs failure") log.Info("falling back to original path due to EvalSymlink/Abs failure")
......
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