From a300027dd01c870eb77d3b71e9555b953cdcc71f Mon Sep 17 00:00:00 2001 From: zaidusmani26 Date: Wed, 6 Sep 2023 16:48:15 -0700 Subject: [PATCH] feat: Ensure warning for CCM deactivation password flag --- internal/flags/deactivate.go | 7 +++++++ internal/flags/deactivate_test.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/flags/deactivate.go b/internal/flags/deactivate.go index 58828b63..87a16941 100644 --- a/internal/flags/deactivate.go +++ b/internal/flags/deactivate.go @@ -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 @@ -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 } diff --git a/internal/flags/deactivate_test.go b/internal/flags/deactivate_test.go index 00f22822..4e98d63a 100644 --- a/internal/flags/deactivate_test.go +++ b/internal/flags/deactivate_test.go @@ -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)