fix communicator
This commit is contained in:
parent
6556a851dc
commit
f208a071a4
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
"github.com/hashicorp/packer/helper/config"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/hashicorp/packer/template/interpolate"
|
||||
)
|
||||
|
||||
|
@ -48,5 +49,10 @@ func NewConfig(raws ...interface{}) (*Config, error) {
|
|||
return nil, fmt.Errorf("Error parsing API Endpoint: %s", err)
|
||||
}
|
||||
|
||||
var errs *packer.MultiError
|
||||
if es := c.Comm.Prepare(&c.ctx); len(es) > 0 {
|
||||
errs = packer.MultiErrorAppend(errs, es...)
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
|
|||
sshPublicKey := strings.TrimSpace(state.Get("publicKey").(string))
|
||||
|
||||
// Load the dynamically-generated SSH key into the Oracle Compute cloud.
|
||||
sshKeyName := fmt.Sprintf("/Compute-%s/%s/packer_dynamic_key", config.IdentityDomain, config.Username)
|
||||
sshKeyName := fmt.Sprintf("/Compute-%s/%s/packer_generated_key", config.IdentityDomain, config.Username)
|
||||
|
||||
sshKeysClient := client.SSHKeys()
|
||||
sshKeysInput := compute.CreateSSHKeyInput{
|
||||
|
@ -31,7 +31,7 @@ func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
|
|||
keyInfo, err := sshKeysClient.CreateSSHKey(&sshKeysInput)
|
||||
if err != nil {
|
||||
// Key already exists; update key instead
|
||||
if strings.Contains(err.Error(), "packer_dynamic_key already exists") {
|
||||
if strings.Contains(err.Error(), "packer_generated_key already exists") {
|
||||
updateKeysInput := compute.UpdateSSHKeyInput{
|
||||
Name: sshKeyName,
|
||||
Key: sshPublicKey,
|
||||
|
|
Loading…
Reference in New Issue