Skip to content

Commit

Permalink
Merge pull request #2158 from gdbranco/fix/ocm-8680-user
Browse files Browse the repository at this point in the history
OCM-8680 | fix: use a tmp file per username
  • Loading branch information
openshift-merge-bot[bot] authored Jun 11, 2024
2 parents a2e1992 + 36d03d8 commit aeae3b6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cache
import (
"fmt"
"os"
"os/user"
"path/filepath"
"strings"
"sync"
Expand Down Expand Up @@ -124,9 +125,13 @@ func (c *rosaCache) Dir() (string, error) {
}

func getAndEnsureOCMDirectoryExists() (string, error) {
ocmDir := "/tmp/ocm"
curUser, err := user.Current()
if err != nil {
return "", err
}
ocmDir := fmt.Sprintf("%s/%s/ocm", os.TempDir(), curUser.Username)

_, err := os.Stat(ocmDir)
_, err = os.Stat(ocmDir)
if err != nil {
if os.IsNotExist(err) {
if err := os.MkdirAll(ocmDir, 0755); err != nil {
Expand Down

0 comments on commit aeae3b6

Please sign in to comment.