Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions libpod/boltdb_state_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,11 @@ func validateDBAgainstConfig(bucket *bolt.Bucket, fieldName, runtimeValue string
return nil
}

// If DB value is the empty string, check that the
// runtime value is the default
if string(keyBytes) == "" && defaultValue != "" &&
runtimeValue == defaultValue {
// If DB value is the empty string, we ought to be fine.
// (Though I'm honestly not sure how we got this far
// with an empty-string DB config)
if string(keyBytes) == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update the data with the correct value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that we don't really know the correct value here - the DB is supposed to know, and it doesn't, so we can only hope that we're using the right storage driver.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've figured out why we're entering "" in the first place though. Going to fix that next.

logrus.Warnf("Database stored empty configuration for %s - unable to validate", fieldName)
return nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ func GetDefaultStoreOptions() (storage.StoreOptions, error) {
err error
)
storageOpts := storage.DefaultStoreOptions
if !rootless.IsRootless() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code makes little sense. Above you set storageOpts to DefaultStoreOptions, then you overwrite it in both root and rootless mode.

storageOpts = storage.StoreOptions{}
}
if rootless.IsRootless() {
storageOpts, err = GetRootlessStorageOpts()
if err != nil {
Expand Down