Some minor rekey backup fixes

This commit is contained in:
Jeff Mitchell
2016-01-08 14:09:40 -05:00
parent 45e32756ea
commit 839b804e43
2 changed files with 11 additions and 11 deletions

View File

@@ -57,8 +57,8 @@ func (c *Sys) RekeyUpdate(shard, nonce string) (*RekeyUpdateResponse, error) {
return &result, err
}
func (c *Sys) RekeyRetrieveStored() (*RekeyRetrieveResponse, error) {
r := c.c.NewRequest("GET", "/v1/sys/rekey/stored")
func (c *Sys) RekeyRetrieveBackup() (*RekeyRetrieveResponse, error) {
r := c.c.NewRequest("GET", "/v1/sys/rekey/backup")
resp, err := c.c.RawRequest(r)
if err != nil {
return nil, err
@@ -70,8 +70,8 @@ func (c *Sys) RekeyRetrieveStored() (*RekeyRetrieveResponse, error) {
return &result, err
}
func (c *Sys) RekeyDeleteStored() error {
r := c.c.NewRequest("DELETE", "/v1/sys/rekey/stored")
func (c *Sys) RekeyDeleteBackup() error {
r := c.c.NewRequest("DELETE", "/v1/sys/rekey/backup")
resp, err := c.c.RawRequest(r)
if err == nil {
defer resp.Body.Close()

View File

@@ -151,9 +151,9 @@ func (c *RekeyCommand) Run(args []string) int {
if len(result.PGPFingerprints) > 0 && result.Backup {
c.Ui.Output(fmt.Sprintf(
"\n" +
"The encrypted unseal keys have been backed up to \"core/unseal-keys\n" +
"in your physical backend. It is your responsibility to remove these\n" +
"if and when desired.",
"The encrypted unseal keys have been backed up to \"core/unseal-keys-backup\"\n" +
"in your physical backend. It is your responsibility to remove these if and\n" +
"when desired.",
))
}
@@ -231,15 +231,15 @@ func (c *RekeyCommand) rekeyStatus(client *api.Client) int {
status.Required,
)
if len(status.PGPFingerprints) != 0 {
statString = fmt.Sprintf("\nPGP Key Fingerprints: %s", status.PGPFingerprints)
statString = fmt.Sprintf("\nBackup Storage: %t", status.Backup)
statString = fmt.Sprintf("\n%s\nPGP Key Fingerprints: %s", statString, status.PGPFingerprints)
statString = fmt.Sprintf("\n%s\nBackup Storage: %t", statString, status.Backup)
}
c.Ui.Output(statString)
return 0
}
func (c *RekeyCommand) rekeyRetrieveStored(client *api.Client) int {
storedKeys, err := client.Sys().RekeyRetrieveStored()
storedKeys, err := client.Sys().RekeyRetrieveBackup()
if err != nil {
c.Ui.Error(fmt.Sprintf("Error retrieving stored keys: %s", err))
return 1
@@ -253,7 +253,7 @@ func (c *RekeyCommand) rekeyRetrieveStored(client *api.Client) int {
}
func (c *RekeyCommand) rekeyDeleteStored(client *api.Client) int {
err := client.Sys().RekeyDeleteStored()
err := client.Sys().RekeyDeleteBackup()
if err != nil {
c.Ui.Error(fmt.Sprintf("Failed to delete stored keys: %s", err))
return 1