use string variable for shared message and fix lint

pull/15868/head
Tongyao Si 2023-02-16 19:07:21 +00:00 committed by Steven Powell
parent 3eb8ef67a7
commit 4a5057c1e9
1 changed files with 7 additions and 2 deletions

View File

@ -292,8 +292,13 @@ func EnableOrDisableAddon(cc *config.ClusterConfig, name string, val string) err
return errors.Wrap(err, "check paused")
}
if runtimePaused {
out.Styled(style.Shrug, `Can't enable addon on a paused cluster, please unpause the cluster firstly.`)
return errors.New("Can't enable addon on a paused cluster, please unpause the cluster firstly.")
action := "disable"
if enable {
action = "enable"
}
msg := fmt.Sprintf("can't %s addon on a paused cluster, please unpause the cluster firstly.", action)
out.Styled(style.Shrug, msg)
return errors.New(msg)
}
bail, err := addonSpecificChecks(cc, name, enable, runner)
if err != nil {