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

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2017-12-20 00:40:57 -08:00
parent 828289db32
commit 9978b4fd35

View File

@ -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))