Optimize string contrast judgment (#5821)

Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
pull/5863/head
Fish-pro 2023-02-06 14:52:01 +08:00 committed by GitHub
parent 843c70959f
commit a761111ba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -112,9 +112,8 @@ func getStorageAccountKey(config map[string]string) (string, error) {
var storageKey string var storageKey string
for _, key := range *res.Keys { for _, key := range *res.Keys {
// uppercase both strings for comparison because the ListKeys call returns e.g. "FULL" but // The ListKeys call returns e.g. "FULL" but the storagemgmt.Full constant in the SDK is defined as "Full".
// the storagemgmt.Full constant in the SDK is defined as "Full". if strings.EqualFold(string(key.Permissions), string(storagemgmt.Full)) {
if strings.ToUpper(string(key.Permissions)) == strings.ToUpper(string(storagemgmt.Full)) {
storageKey = *key.Value storageKey = *key.Value
break break
} }

View File

@ -462,9 +462,9 @@ func VeleroScheduleCreate(ctx context.Context, veleroCLI string, veleroNamespace
func VeleroSchedulePause(ctx context.Context, veleroCLI string, veleroNamespace string, scheduleName string) error { func VeleroSchedulePause(ctx context.Context, veleroCLI string, veleroNamespace string, scheduleName string) error {
var args []string var args []string
args = append([]string{ args = []string{
"--namespace", veleroNamespace, "schedule", "pause", scheduleName, "--namespace", veleroNamespace, "schedule", "pause", scheduleName,
}) }
if err := VeleroCmdExec(ctx, veleroCLI, args); err != nil { if err := VeleroCmdExec(ctx, veleroCLI, args); err != nil {
return err return err
} }
@ -473,9 +473,9 @@ func VeleroSchedulePause(ctx context.Context, veleroCLI string, veleroNamespace
func VeleroScheduleUnpause(ctx context.Context, veleroCLI string, veleroNamespace string, scheduleName string) error { func VeleroScheduleUnpause(ctx context.Context, veleroCLI string, veleroNamespace string, scheduleName string) error {
var args []string var args []string
args = append([]string{ args = []string{
"--namespace", veleroNamespace, "schedule", "unpause", scheduleName, "--namespace", veleroNamespace, "schedule", "unpause", scheduleName,
}) }
if err := VeleroCmdExec(ctx, veleroCLI, args); err != nil { if err := VeleroCmdExec(ctx, veleroCLI, args); err != nil {
return err return err
} }