Merge pull request #8091 from dcantah/mirror-generic-toml-change

This commit is contained in:
Fu Wei 2023-02-12 11:23:34 +08:00 committed by GitHub
commit 040fcf85f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -359,6 +359,16 @@ func generateRuntimeOptions(r criconfig.Runtime, c criconfig.Config) (interface{
if err := optionsTree.Unmarshal(options); err != nil { if err := optionsTree.Unmarshal(options); err != nil {
return nil, err return nil, err
} }
// For generic configuration, if no config path specified (preserving old behavior), pass
// the whole TOML configuration section to the runtime.
if runtimeOpts, ok := options.(*runtimeoptions.Options); ok && runtimeOpts.ConfigPath == "" {
runtimeOpts.ConfigBody, err = optionsTree.Marshal()
if err != nil {
return nil, fmt.Errorf("failed to marshal TOML blob for runtime %q: %v", r.Type, err)
}
}
return options, nil return options, nil
} }