Show renewable status for tokens in output

This commit is contained in:
Jeff Mitchell 2016-06-01 17:30:31 -04:00
parent e9fbb9fabe
commit f8d70b64a0
2 changed files with 7 additions and 0 deletions

View File

@ -1280,6 +1280,11 @@ func (ts *TokenStore) handleLookup(
if !leaseTimes.ExpireTime.IsZero() {
resp.Data["ttl"] = int64(leaseTimes.ExpireTime.Sub(time.Now().Round(time.Second)).Seconds())
}
if err := leaseTimes.renewable(); err == nil {
resp.Data["renewable"] = true
} else {
resp.Data["renewable"] = false
}
}
return resp, nil

View File

@ -1016,6 +1016,7 @@ func TestTokenStore_HandleRequest_Lookup(t *testing.T) {
"ttl": int64(3600),
"role": "",
"explicit_max_ttl": int64(0),
"renewable": true,
}
if resp.Data["creation_time"].(int64) == 0 {
@ -1058,6 +1059,7 @@ func TestTokenStore_HandleRequest_Lookup(t *testing.T) {
"ttl": int64(3600),
"role": "",
"explicit_max_ttl": int64(0),
"renewable": true,
}
if resp.Data["creation_time"].(int64) == 0 {