builder.scaleway: use c.Comm for ssh
This commit is contained in:
parent
0f9eddda3a
commit
4fdf5714a6
@ -50,8 +50,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||||||
steps := []multistep.Step{
|
steps := []multistep.Step{
|
||||||
&stepCreateSSHKey{
|
&stepCreateSSHKey{
|
||||||
Debug: b.config.PackerDebug,
|
Debug: b.config.PackerDebug,
|
||||||
|
Comm: &b.config.Comm,
|
||||||
DebugKeyPath: fmt.Sprintf("scw_%s.pem", b.config.PackerBuildName),
|
DebugKeyPath: fmt.Sprintf("scw_%s.pem", b.config.PackerBuildName),
|
||||||
PrivateKeyFile: b.config.Comm.SSHPrivateKeyFile,
|
|
||||||
},
|
},
|
||||||
new(stepCreateServer),
|
new(stepCreateServer),
|
||||||
new(stepServerInfo),
|
new(stepServerInfo),
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
|
"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"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
@ -20,17 +21,17 @@ import (
|
|||||||
|
|
||||||
type stepCreateSSHKey struct {
|
type stepCreateSSHKey struct {
|
||||||
Debug bool
|
Debug bool
|
||||||
|
Comm *communicator.Config
|
||||||
DebugKeyPath string
|
DebugKeyPath string
|
||||||
PrivateKeyFile string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stepCreateSSHKey) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepCreateSSHKey) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packer.Ui)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
|
|
||||||
if s.PrivateKeyFile != "" {
|
if s.Comm.SSHPrivateKeyFile != "" {
|
||||||
ui.Say("Using existing SSH private key")
|
ui.Say("Using existing SSH private key")
|
||||||
privateKeyBytes, err := ioutil.ReadFile(s.PrivateKeyFile)
|
privateKeyBytes, err := ioutil.ReadFile(s.Comm.SSHPrivateKeyFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
state.Put("error", fmt.Errorf(
|
state.Put("error", fmt.Errorf(
|
||||||
"Error loading configured private key file: %s", err))
|
"Error loading configured private key file: %s", err))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user