Skip to content

Commit

Permalink
path fix for reading cpus.yaml file bug when building locally
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriela Dozortsev <gdozorts@redhat.com>
  • Loading branch information
root authored and gdozortsev committed Jun 20, 2024
1 parent 7ab6af2 commit 34d0b95
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/collector/stats/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,16 @@ func getS390xArchitecture() (string, error) {
func getCPUMicroArchitecture(family, model, stepping string) (string, error) {
yamlBytes, err := os.ReadFile(CPUModelDataPath)
if err != nil {
klog.Errorf("failed to read cpus.yaml: %v", err)
return "", err
currentFilePath, err := os.Getwd()
if err != nil {
return "", err
}
LocalCPUModelDataPath := strings.SplitAfter(currentFilePath, "kepler")[0]
yamlBytes, err = os.ReadFile(LocalCPUModelDataPath + "/data/cpus.yaml")
if err != nil {
klog.Errorf("failed to read cpus.yaml: %v", err)
return "", err
}
}
cpus := &CPUS{
cpusInfo: []CPUModelData{},
Expand Down

0 comments on commit 34d0b95

Please sign in to comment.