checking in
This commit is contained in:
30
cmd/kill/funcs.go
Normal file
30
cmd/kill/funcs.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
`github.com/hashicorp/vault-client-go`
|
||||
)
|
||||
|
||||
// killKeyAsync kills key keyNm if found in the Vault mount.
|
||||
func killKeyAsync(keyNm string) {
|
||||
|
||||
var err error
|
||||
var ok bool
|
||||
|
||||
defer wg.Done()
|
||||
|
||||
if _, ok = existingOtp[keyNm]; !ok {
|
||||
logger.Warning("Key '%s' does not exist on '%s'; skipping.", keyNm, args.KillArgs.VaultTotpMnt)
|
||||
return
|
||||
}
|
||||
|
||||
if _, err = vc.Secrets.TotpDeleteKey(
|
||||
ctx,
|
||||
keyNm,
|
||||
vault.WithMountPath(args.KillArgs.VaultTotpMnt),
|
||||
); err != nil {
|
||||
logger.Err("killKeyAsync: Failed to delete key '%s' on '%s': %v", keyNm, args.KillArgs.VaultTotpMnt, err)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user