Prechádzať zdrojové kódy

etcdctl/ctlv3: clarify "lease timetolive" output on expired lease

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 8 rokov pred
rodič
commit
9978b4fd35
1 zmenil súbory, kde vykonal 5 pridanie a 0 odobranie
  1. 5 0
      etcdctl/ctlv3/command/printer_simple.go

+ 5 - 0
etcdctl/ctlv3/command/printer_simple.go

@@ -93,6 +93,11 @@ func (p *simplePrinter) KeepAlive(resp v3.LeaseKeepAliveResponse) {
 }
 
 func (s *simplePrinter) TimeToLive(resp v3.LeaseTimeToLiveResponse, keys bool) {
+	if resp.GrantedTTL == 0 && resp.TTL == -1 {
+		fmt.Printf("lease %016x already expired\n", resp.ID)
+		return
+	}
+
 	txt := fmt.Sprintf("lease %016x granted with TTL(%ds), remaining(%ds)", resp.ID, resp.GrantedTTL, resp.TTL)
 	if keys {
 		ks := make([]string, len(resp.Keys))