From 583e341ae78e7b2bcb84090d16c2717f03db5345 Mon Sep 17 00:00:00 2001 From: Lars Wander Date: Thu, 3 Nov 2016 12:49:09 -0400 Subject: [PATCH] builder/googlecompute: Store empty public_key --- builder/googlecompute/step_create_instance.go | 6 +----- builder/googlecompute/step_create_ssh_key.go | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/builder/googlecompute/step_create_instance.go b/builder/googlecompute/step_create_instance.go index 813295f30..1707ef654 100644 --- a/builder/googlecompute/step_create_instance.go +++ b/builder/googlecompute/step_create_instance.go @@ -69,13 +69,9 @@ func getImage(c *Config, d Driver) (*Image, error) { func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction { c := state.Get("config").(*Config) d := state.Get("driver").(Driver) + sshPublicKey := state.Get("ssh_public_key").(string) ui := state.Get("ui").(packer.Ui) - sshPublicKey := "" - if sshPublicKeyRaw, ok := state.GetOk("ssh_public_key"); ok { - sshPublicKey = sshPublicKeyRaw.(string) - } - sourceImage, err := getImage(c, d) if err != nil { err := fmt.Errorf("Error getting source image for instance creation: %s", err) diff --git a/builder/googlecompute/step_create_ssh_key.go b/builder/googlecompute/step_create_ssh_key.go index 7d6c27622..1012867b6 100644 --- a/builder/googlecompute/step_create_ssh_key.go +++ b/builder/googlecompute/step_create_ssh_key.go @@ -37,6 +37,7 @@ func (s *StepCreateSSHKey) Run(state multistep.StateBag) multistep.StepAction { } state.Put("ssh_private_key", string(privateKeyBytes)) + state.Put("ssh_public_key", "") return multistep.ActionContinue }