Skip to content

Commit

Permalink
feat: Ensure warning for CCM deactivation password flag
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidusmani26 committed Sep 6, 2023
1 parent 06b67ec commit a300027
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 a300027

Please sign in to comment.