cli/json: correctly output the number of key shares and threshold on stored keys (#5910)

This commit is contained in:
Calvin Leung Huang
2018-12-12 12:26:11 -08:00
committed by Jeff Mitchell
parent e366aeb2e3
commit 7ac17d69c0

View File

@@ -549,8 +549,15 @@ func newMachineInit(req *api.InitRequest, resp *api.InitResponse) *machineInit {
init.UnsealKeysB64[i] = v
}
init.UnsealShares = req.SecretShares
init.UnsealThreshold = req.SecretThreshold
// If we don't get a set of keys back, it means that we are storing the keys,
// so the key shares and threshold has been set to 1.
if len(resp.Keys) == 0 {
init.UnsealShares = 1
init.UnsealThreshold = 1
} else {
init.UnsealShares = req.SecretShares
init.UnsealThreshold = req.SecretThreshold
}
init.RecoveryKeysHex = make([]string, len(resp.RecoveryKeys))
for i, v := range resp.RecoveryKeys {