added isEnabledOrDefault
parent
2ac143527f
commit
f88c6ad3cd
|
@ -538,7 +538,7 @@ func ToEnable(cc *config.ClusterConfig, existing map[string]bool, additional []s
|
|||
// Get the default values of any addons not saved to our config
|
||||
for name, a := range assets.Addons {
|
||||
if _, exists := existing[name]; !exists {
|
||||
enable[name] = a.IsEnabled(cc)
|
||||
enable[name] = a.IsEnabledOrDefault(cc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,16 @@ func (a *Addon) IsEnabled(cc *config.ClusterConfig) bool {
|
|||
return status
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// IsEnabledOrDefault checks if an Addon is enabled for the given profile. If not found in profile it returns the default state
|
||||
func (a *Addon) IsEnabledOrDefault(cc *config.ClusterConfig) bool {
|
||||
status, ok := cc.Addons[a.Name()]
|
||||
if ok {
|
||||
return status
|
||||
}
|
||||
|
||||
// Return the default unconfigured state of the addon
|
||||
return a.enabled
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue