Skip to content

Commit

Permalink
Reduce noise when importing PostgreSQL Flexible Server Configurations (
Browse files Browse the repository at this point in the history
…#4279)

* Code gardening

* Filter out readonly configuration

* Filter out default values
  • Loading branch information
theunrepentantgeek authored Sep 18, 2024
1 parent b5287c3 commit 0a048e3
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,23 @@ func (extension *FlexibleServersConfigurationExtension) Import(
// API version in the generator.)
if config, ok := rsrc.(*api.FlexibleServersConfiguration); ok {
// Skip system defaults
if config.Spec.Source != nil && *config.Spec.Source == "system-default" {
if config.Spec.Source != nil &&
*config.Spec.Source == "system-default" {
return extensions.ImportSkipped("system-defaults don't need to be imported"), nil
}

// Skip readonly configuration
if config.Status.IsReadOnly != nil &&
*config.Status.IsReadOnly {
return extensions.ImportSkipped("readonly configuration can't be set"), nil
}

// Skip default values
if config.Status.DefaultValue != nil &&
config.Status.Value != nil &&
*config.Status.DefaultValue == *config.Status.Value {
return extensions.ImportSkipped("default value is the same as the current value"), nil
}
}

return result, nil
Expand Down

0 comments on commit 0a048e3

Please sign in to comment.