From 02139dcb6981059e5cf7b08fc4973343217e11c6 Mon Sep 17 00:00:00 2001 From: Daisuke Takahashi Date: Thu, 13 Sep 2018 12:10:32 +0900 Subject: [PATCH] Fix bugs --- builder/openstack/builder.go | 1 + builder/openstack/step_run_source_server.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/builder/openstack/builder.go b/builder/openstack/builder.go index 055cd3713..b049868ca 100644 --- a/builder/openstack/builder.go +++ b/builder/openstack/builder.go @@ -110,6 +110,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ConfigDrive: b.config.ConfigDrive, InstanceMetadata: b.config.InstanceMetadata, UseBlockStorageVolume: b.config.UseBlockStorageVolume, + Comm: &b.config.Comm, }, &StepGetPassword{ Debug: b.config.PackerDebug, diff --git a/builder/openstack/step_run_source_server.go b/builder/openstack/step_run_source_server.go index 3b0a4c5c7..90dbb2f9c 100644 --- a/builder/openstack/step_run_source_server.go +++ b/builder/openstack/step_run_source_server.go @@ -9,6 +9,7 @@ import ( "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/bootfromvolume" "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" + "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" ) @@ -27,6 +28,7 @@ type StepRunSourceServer struct { InstanceMetadata map[string]string UseBlockStorageVolume bool server *servers.Server + Comm *communicator.Config } func (s *StepRunSourceServer) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { @@ -107,7 +109,7 @@ func (s *StepRunSourceServer) Run(_ context.Context, state multistep.StateBag) m } // Add keypair to the server create options. - keyName := config.Comm.SSHKeyPairName + keyName := s.Comm.SSHKeyPairName if keyName != "" { serverOptsExt = keypairs.CreateOptsExt{ CreateOptsBuilder: serverOptsExt,