builder/googlecompute: Store empty public_key

This commit is contained in:
Lars Wander 2016-11-03 12:49:09 -04:00
parent 7f474d8f78
commit 583e341ae7
2 changed files with 2 additions and 5 deletions

View File

@ -69,13 +69,9 @@ func getImage(c *Config, d Driver) (*Image, error) {
func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction { func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction {
c := state.Get("config").(*Config) c := state.Get("config").(*Config)
d := state.Get("driver").(Driver) d := state.Get("driver").(Driver)
sshPublicKey := state.Get("ssh_public_key").(string)
ui := state.Get("ui").(packer.Ui) ui := state.Get("ui").(packer.Ui)
sshPublicKey := ""
if sshPublicKeyRaw, ok := state.GetOk("ssh_public_key"); ok {
sshPublicKey = sshPublicKeyRaw.(string)
}
sourceImage, err := getImage(c, d) sourceImage, err := getImage(c, d)
if err != nil { if err != nil {
err := fmt.Errorf("Error getting source image for instance creation: %s", err) err := fmt.Errorf("Error getting source image for instance creation: %s", err)

View File

@ -37,6 +37,7 @@ func (s *StepCreateSSHKey) Run(state multistep.StateBag) multistep.StepAction {
} }
state.Put("ssh_private_key", string(privateKeyBytes)) state.Put("ssh_private_key", string(privateKeyBytes))
state.Put("ssh_public_key", "")
return multistep.ActionContinue return multistep.ActionContinue
} }