Skip to content

Commit

Permalink
Merge pull request #282 from JimmyYang20/fixbug-lc
Browse files Browse the repository at this point in the history
Fixbug: db path has missed the mount volume prefix in LC
  • Loading branch information
kubeedge-bot authored Mar 16, 2022
2 parents ab20013 + 7310b7b commit 527c574
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/localcontroller/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"k8s.io/klog/v2"

"github.com/kubeedge/sedna/pkg/localcontroller/common/constants"
"github.com/kubeedge/sedna/pkg/localcontroller/util"
)

// Resource defines resource (e.g., dataset, model, jointinferenceservice) table
Expand Down Expand Up @@ -117,7 +118,13 @@ func init() {

// getClient gets db client
func getClient() *gorm.DB {
dbURL := constants.DataBaseURL
var prefix string
var ok bool
if prefix, ok = os.LookupEnv(constants.RootFSMountDirENV); !ok {
prefix = "/rootfs"
}

dbURL := util.AddPrefixPath(prefix, constants.DataBaseURL)

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

0 comments on commit 527c574

Please sign in to comment.