Skip to content

Commit

Permalink
feat: Add password prompt for local activation
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidusmani26 committed Sep 6, 2023
1 parent 09fdd03 commit 0ffb8a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions internal/flags/deactivate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ 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) == 5 && f.commandLineArgs[3] == "-password" && !f.UseACM {
log.Warn("Password not required for CCM deactivation")
}

Check warning on line 15 in internal/flags/deactivate.go

View check run for this annotation

Codecov / codecov/patch

internal/flags/deactivate.go#L14-L15

Added lines #L14 - L15 were not covered by tests
if len(f.commandLineArgs) == 2 {
f.amtDeactivateCommand.PrintDefaults()
return utils.IncorrectCommandLineParameters
Expand Down
3 changes: 1 addition & 2 deletions internal/flags/deactivate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,11 @@ 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)
}

func TestParseFlagsDeactivate(t *testing.T) {
args := []string{"./rpc", "deactivate"}
flags := NewFlags(args)
Expand Down

0 comments on commit 0ffb8a9

Please sign in to comment.