|
|
@@ -67,7 +67,7 @@ func leaseGrantCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
if err != nil {
|
|
|
ExitWithError(ExitError, fmt.Errorf("failed to grant lease (%v)\n", err))
|
|
|
}
|
|
|
- fmt.Printf("lease %016x granted with TTL(%ds)\n", resp.ID, resp.TTL)
|
|
|
+ display.Grant(*resp)
|
|
|
}
|
|
|
|
|
|
// NewLeaseRevokeCommand returns the cobra command for "lease revoke".
|
|
|
@@ -90,12 +90,12 @@ func leaseRevokeCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
|
|
|
id := leaseFromArgs(args[0])
|
|
|
ctx, cancel := commandCtx(cmd)
|
|
|
- _, err := mustClientFromCmd(cmd).Revoke(ctx, id)
|
|
|
+ resp, err := mustClientFromCmd(cmd).Revoke(ctx, id)
|
|
|
cancel()
|
|
|
if err != nil {
|
|
|
ExitWithError(ExitError, fmt.Errorf("failed to revoke lease (%v)\n", err))
|
|
|
}
|
|
|
- fmt.Printf("lease %016x revoked\n", id)
|
|
|
+ display.Revoke(id, *resp)
|
|
|
}
|
|
|
|
|
|
var timeToLiveKeys bool
|
|
|
@@ -154,9 +154,12 @@ func leaseKeepAliveCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
}
|
|
|
|
|
|
for resp := range respc {
|
|
|
- fmt.Printf("lease %016x keepalived with TTL(%d)\n", resp.ID, resp.TTL)
|
|
|
+ display.KeepAlive(*resp)
|
|
|
+ }
|
|
|
+
|
|
|
+ if _, ok := (display).(*simplePrinter); ok {
|
|
|
+ fmt.Printf("lease %016x expired or revoked.\n", id)
|
|
|
}
|
|
|
- fmt.Printf("lease %016x expired or revoked.\n", id)
|
|
|
}
|
|
|
|
|
|
func leaseFromArgs(arg string) v3.LeaseID {
|