Skip to content

Commit

Permalink
Preserve old keys/certs in Keypair.Render()
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed May 4, 2021
1 parent 1cc7831 commit c24e359
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions upup/pkg/fi/fitasks/keypair.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ func (_ *Keypair) Render(c *fi.Context, a, e, changes *Keypair) error {
return err
}
if keyset == nil {
keyset = &fi.Keyset{}
keyset = &fi.Keyset{
Items: map[string]*fi.KeysetItem{},
}
}

// We always reuse the private key if it exists,
Expand Down Expand Up @@ -232,13 +234,9 @@ func (_ *Keypair) Render(c *fi.Context, a, e, changes *Keypair) error {
PrivateKey: privateKey,
}

keyset = &fi.Keyset{
LegacyFormat: false,
Items: map[string]*fi.KeysetItem{
serialString: ki,
},
Primary: ki,
}
keyset.LegacyFormat = false
keyset.Items[ki.Id] = ki
keyset.Primary = ki
err = c.Keystore.StoreKeyset(name, keyset)
if err != nil {
return err
Expand Down

0 comments on commit c24e359

Please sign in to comment.