Skip to content

Commit

Permalink
Don't migrate legacy vendor.
Browse files Browse the repository at this point in the history
  • Loading branch information
dplepage-dd committed Jan 29, 2025
1 parent ce50e7f commit 0ceacc9
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions pkg/networkdevice/profile/profiledefinition/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,23 @@ const (
func ValidateEnrichProfile(profile *ProfileDefinition) []string {
NormalizeMetrics(profile.Metrics)
// migrate legacy profile.Device.Vendor to metadata field.
if profile.Device.Vendor != "" {
dev, ok := profile.Metadata["device"]
if !ok {
profile.Metadata["device"] = MetadataResourceConfig{
Fields: make(map[string]MetadataField),
}
dev = profile.Metadata["device"]
}
_, ok = dev.Fields["vendor"]
if !ok {
dev.Fields["vendor"] = MetadataField{
Value: profile.Device.Vendor,
}
}
profile.Device.Vendor = ""
}
// TODO this is commented out because it changes existing behavior; uncomment when we want to support this properly.
// if profile.Device.Vendor != "" {
// dev, ok := profile.Metadata["device"]
// if !ok {
// profile.Metadata["device"] = MetadataResourceConfig{
// Fields: make(map[string]MetadataField),
// }
// dev = profile.Metadata["device"]
// }
// _, ok = dev.Fields["vendor"]
// if !ok {
// dev.Fields["vendor"] = MetadataField{
// Value: profile.Device.Vendor,
// }
// }
// profile.Device.Vendor = ""
// }
errors := ValidateEnrichMetadata(profile.Metadata)
errors = append(errors, ValidateEnrichMetrics(profile.Metrics)...)
errors = append(errors, ValidateEnrichMetricTags(profile.MetricTags)...)
Expand Down

0 comments on commit 0ceacc9

Please sign in to comment.