Skip to content

Commit

Permalink
cilium-dbg: Refactor confirmation message for encrypt flush
Browse files Browse the repository at this point in the history
This commit refactors the code a bit simplify a latter commit. No
functional changes.

This may be a bit excessive in commit splitting, but at least I can
claim my last commit is free of any refactoring 😅

Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
  • Loading branch information
pchaigno committed Mar 6, 2024
1 parent 927969b commit 5c2a67f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cilium-dbg/cmd/encrypt_flush.go
Expand Up @@ -75,12 +75,13 @@ func runXFRMFlush() {
policies, states = filterXFRMByNodeID(policies, states)
}

confirmationMsg := ""
if len(policies) == nbPolicies || len(states) == nbStates {
confirmationMsg := "Running this command will delete all XFRM state and/or policies. " +
confirmationMsg = "Running this command will delete all XFRM states and/or policies. " +
"It will lead to transient connectivity disruption and plain-text pod-to-pod traffic."
if !confirmXFRMCleanup(confirmationMsg) {
return
}
}
if confirmationMsg != "" && !confirmXFRMCleanup(confirmationMsg) {
return
}

nbDeleted := len(states)
Expand Down

0 comments on commit 5c2a67f

Please sign in to comment.