Follow variable privateKey <-> statebag private_key convention

This commit is contained in:
DanHam 2018-05-03 00:17:51 +01:00
parent 64d1265ab8
commit 585b93cfd6
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E
2 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
}
if config.Comm.SSHPrivateKey != "" {
if priv, ok := state.GetOk("privateKey"); ok {
if priv, ok := state.GetOk("private_key"); ok {
privateKey = priv.(string)
}
signer, err := ssh.ParsePrivateKey([]byte(privateKey))

View File

@ -36,7 +36,7 @@ func (s *stepCreateSSHKey) Run(_ context.Context, state multistep.StateBag) mult
return multistep.ActionHalt
}
state.Put("privateKey", string(privateKeyBytes))
state.Put("private_key", string(privateKeyBytes))
state.Put("ssh_pubkey", "")
return multistep.ActionContinue
@ -61,7 +61,7 @@ func (s *stepCreateSSHKey) Run(_ context.Context, state multistep.StateBag) mult
}
// Set the private key in the statebag for later
state.Put("privateKey", string(pem.EncodeToMemory(&priv_blk)))
state.Put("private_key", string(pem.EncodeToMemory(&priv_blk)))
pub, _ := ssh.NewPublicKey(&priv.PublicKey)
pub_sshformat := string(ssh.MarshalAuthorizedKey(pub))