From f208a071a4d4ce941b0fde6a2bea3b5c8d994276 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 18 Jan 2018 15:52:31 -0800 Subject: [PATCH] fix communicator --- builder/oracle/classic/config.go | 6 ++++++ builder/oracle/classic/step_create_instance.go | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/builder/oracle/classic/config.go b/builder/oracle/classic/config.go index 8cdd9aff6..733d2252c 100644 --- a/builder/oracle/classic/config.go +++ b/builder/oracle/classic/config.go @@ -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 } diff --git a/builder/oracle/classic/step_create_instance.go b/builder/oracle/classic/step_create_instance.go index fd91ea930..1456da99e 100644 --- a/builder/oracle/classic/step_create_instance.go +++ b/builder/oracle/classic/step_create_instance.go @@ -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,