Skip to content

Commit

Permalink
feat: ensure warning for CCM deactivation password flag
Browse files Browse the repository at this point in the history
closes AB#18321
  • Loading branch information
zaidusmani26 committed Sep 7, 2023
1 parent 06b67ec commit 9f04c3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions internal/flags/deactivate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ package flags
import (
"fmt"
"rpc/pkg/utils"

log "github.com/sirupsen/logrus"
)

func (f *Flags) handleDeactivateCommand() int {
f.amtDeactivateCommand.BoolVar(&f.Local, "local", false, "Execute command to AMT directly without cloud interaction")

if len(f.commandLineArgs) == 2 {
f.amtDeactivateCommand.PrintDefaults()
return utils.IncorrectCommandLineParameters
Expand All @@ -30,5 +33,9 @@ func (f *Flags) handleDeactivateCommand() int {
}
}
}

if f.Password != "" && !f.UseACM {
log.Warn("Password not required for CCM deactivation")
}
return utils.Success
}
2 changes: 1 addition & 1 deletion internal/flags/deactivate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestHandleDeactivateCommandWithForce(t *testing.T) {
}

func TestHandleLocalDeactivation(t *testing.T) {
args := []string{"./rpc", "deactivate", "-local"}
args := []string{"./rpc", "deactivate", "-local", "password"}
flags := NewFlags(args)
errCode := flags.ParseFlags()
assert.Equal(t, errCode, utils.Success)
Expand Down

0 comments on commit 9f04c3f

Please sign in to comment.