Skip to content

Commit

Permalink
Merge pull request #867 from rhatdan/reload
Browse files Browse the repository at this point in the history
    ReloadConfigurationFile should Reset storage options
  • Loading branch information
rhatdan authored Apr 12, 2021
2 parents 5dc7256 + c12c9e2 commit 6a7e256
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions types/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) {
fmt.Printf("Failed to parse %s %v\n", configFile, err.Error())
return
}

// Clear storeOptions of previos settings
*storeOptions = StoreOptions{}
if config.Storage.Driver != "" {
storeOptions.GraphDriverName = config.Storage.Driver
}
Expand Down Expand Up @@ -341,13 +344,13 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) {
if err != nil {
fmt.Print(err)
} else {
storeOptions.UIDMap = append(storeOptions.UIDMap, uidmap...)
storeOptions.UIDMap = uidmap
}
gidmap, err := idtools.ParseIDMap([]string{config.Storage.Options.RemapGIDs}, "remap-gids")
if err != nil {
fmt.Print(err)
} else {
storeOptions.GIDMap = append(storeOptions.GIDMap, gidmap...)
storeOptions.GIDMap = gidmap
}
storeOptions.RootAutoNsUser = config.Storage.Options.RootAutoUsernsUser
if config.Storage.Options.AutoUsernsMinSize > 0 {
Expand All @@ -359,8 +362,8 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) {

storeOptions.GraphDriverOptions = append(storeOptions.GraphDriverOptions, cfg.GetGraphDriverOptions(storeOptions.GraphDriverName, config.Storage.Options)...)

if os.Getenv("STORAGE_OPTS") != "" {
storeOptions.GraphDriverOptions = append(storeOptions.GraphDriverOptions, strings.Split(os.Getenv("STORAGE_OPTS"), ",")...)
if opts, ok := os.LookupEnv("STORAGE_OPTS"); ok {
storeOptions.GraphDriverOptions = strings.Split(opts, ",")
}
if len(storeOptions.GraphDriverOptions) == 1 && storeOptions.GraphDriverOptions[0] == "" {
storeOptions.GraphDriverOptions = nil
Expand Down

0 comments on commit 6a7e256

Please sign in to comment.