Merge pull request #6701 from shield-9/fix-openstack
OpenStack: SSH keypair is not attached
This commit is contained in:
commit
433003181b
|
@ -110,6 +110,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
ConfigDrive: b.config.ConfigDrive,
|
ConfigDrive: b.config.ConfigDrive,
|
||||||
InstanceMetadata: b.config.InstanceMetadata,
|
InstanceMetadata: b.config.InstanceMetadata,
|
||||||
UseBlockStorageVolume: b.config.UseBlockStorageVolume,
|
UseBlockStorageVolume: b.config.UseBlockStorageVolume,
|
||||||
|
Comm: &b.config.Comm,
|
||||||
},
|
},
|
||||||
&StepGetPassword{
|
&StepGetPassword{
|
||||||
Debug: b.config.PackerDebug,
|
Debug: b.config.PackerDebug,
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/bootfromvolume"
|
"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/extensions/keypairs"
|
||||||
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
|
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
|
||||||
|
"github.com/hashicorp/packer/helper/communicator"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
)
|
)
|
||||||
|
@ -27,6 +28,7 @@ type StepRunSourceServer struct {
|
||||||
InstanceMetadata map[string]string
|
InstanceMetadata map[string]string
|
||||||
UseBlockStorageVolume bool
|
UseBlockStorageVolume bool
|
||||||
server *servers.Server
|
server *servers.Server
|
||||||
|
Comm *communicator.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepRunSourceServer) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
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.
|
// Add keypair to the server create options.
|
||||||
keyName := config.Comm.SSHKeyPairName
|
keyName := s.Comm.SSHKeyPairName
|
||||||
if keyName != "" {
|
if keyName != "" {
|
||||||
serverOptsExt = keypairs.CreateOptsExt{
|
serverOptsExt = keypairs.CreateOptsExt{
|
||||||
CreateOptsBuilder: serverOptsExt,
|
CreateOptsBuilder: serverOptsExt,
|
||||||
|
|
Loading…
Reference in New Issue