Skip to content

Commit be041f4

Browse files
committed
os_release.go: Follow symlink to real os-release path.
Fixes: prometheus#2981
1 parent bf67c85 commit be041f4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

collector/os_release.go

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"errors"
1919
"io"
2020
"os"
21+
"path/filepath"
2122
"regexp"
2223
"strconv"
2324
"strings"
@@ -128,6 +129,11 @@ func parseOSRelease(r io.Reader) (*osRelease, error) {
128129
}
129130

130131
func (c *osReleaseCollector) UpdateStruct(path string) error {
132+
path, err := filepath.EvalSymlinks(path)
133+
if err != nil {
134+
return err
135+
}
136+
131137
releaseFile, err := os.Open(path)
132138
if err != nil {
133139
return err

0 commit comments

Comments
 (0)