Re-add kinds config field to tbot with a deprecation warning (#12933)

* Re-add `kinds` config field with a deprecation warning

This re-adds the `kinds` config field with a deprecation warning. We
removed the field in #11596 but due to strict YAML parsing this
causes existing otherwise compatible configs to error out.

* Update tool/tbot/config/config_destination.go

Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>

* Use standardized deprecation comment formatting

Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
This commit is contained in:
Tim Buckley 2022-05-27 15:26:19 -06:00 committed by GitHub
parent e8cfe5df6d
commit 17dbc2d287
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,6 +51,11 @@ type DestinationConfig struct {
Roles []string `yaml:"roles,omitempty"`
Configs []TemplateConfig `yaml:"configs,omitempty"`
// Kinds is a deprecated and unused field that remains for compatibility
// reasons.
// DELETE IN 11.0.0: Kinds should be removed after a grace period.
Kinds []string `yaml:"kinds,omitempty"`
Database *DatabaseConfig `yaml:"database,omitempty"`
}
@ -107,6 +112,12 @@ func (dc *DestinationConfig) CheckAndSetDefaults() error {
}
}
if len(dc.Kinds) > 0 {
log.Warnf("The `kinds` configuration field has been deprecated and " +
"will be removed in a future release. It is now a no-op and can " +
"safely be removed from the configuration file.")
}
return nil
}