Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix keyring import from older versions. #8436

Merged
merged 8 commits into from
Feb 2, 2021
Merged
10 changes: 5 additions & 5 deletions client/keys/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {

var (
tmpDir string
migrator keyring.InfoImporter
migrator keyring.Importer
)

if dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun); dryRun {
Expand All @@ -73,10 +73,10 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {

defer os.RemoveAll(tmpDir)

migrator, err = keyring.NewInfoImporter(keyringServiceName, "test", tmpDir, buf)
migrator, err = keyring.New(keyringServiceName, keyring.BackendTest, tmpDir, buf)
} else {
backend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend)
migrator, err = keyring.NewInfoImporter(keyringServiceName, backend, rootDir, buf)
migrator, err = keyring.New(keyringServiceName, backend, rootDir, buf)
}

if err != nil {
Expand Down Expand Up @@ -107,7 +107,7 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {
}

if keyType != keyring.TypeLocal {
if err := migrator.Import(keyName, legKeyInfo); err != nil {
if err := migrator.ImportPubKey(keyName, legKeyInfo); err != nil {
return err
}

Expand All @@ -127,7 +127,7 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {
return err
}

if err := migrator.Import(keyName, armoredPriv); err != nil {
if err := migrator.ImportPrivKey(keyName, armoredPriv, migratePassphrase); err != nil {
return err
}
}
Expand Down