commit
4f78876754
|
@ -24,7 +24,7 @@ var (
|
||||||
func SSHHost(e ec2Describer, sshInterface string, host string) func(multistep.StateBag) (string, error) {
|
func SSHHost(e ec2Describer, sshInterface string, host string) func(multistep.StateBag) (string, error) {
|
||||||
return func(state multistep.StateBag) (string, error) {
|
return func(state multistep.StateBag) (string, error) {
|
||||||
if host != "" {
|
if host != "" {
|
||||||
log.Printf("Using ssh_host value: %s", host)
|
log.Printf("Using host value: %s", host)
|
||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
Host: awscommon.SSHHost(
|
Host: awscommon.SSHHost(
|
||||||
ec2conn,
|
ec2conn,
|
||||||
b.config.SSHInterface,
|
b.config.SSHInterface,
|
||||||
b.config.Comm.SSHHost,
|
b.config.Comm.Host(),
|
||||||
),
|
),
|
||||||
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -282,7 +282,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
Host: awscommon.SSHHost(
|
Host: awscommon.SSHHost(
|
||||||
ec2conn,
|
ec2conn,
|
||||||
b.config.SSHInterface,
|
b.config.SSHInterface,
|
||||||
b.config.Comm.SSHHost,
|
b.config.Comm.Host(),
|
||||||
),
|
),
|
||||||
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -252,7 +252,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
Host: awscommon.SSHHost(
|
Host: awscommon.SSHHost(
|
||||||
ec2conn,
|
ec2conn,
|
||||||
b.config.SSHInterface,
|
b.config.SSHInterface,
|
||||||
b.config.Comm.SSHHost,
|
b.config.Comm.Host(),
|
||||||
),
|
),
|
||||||
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -342,7 +342,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
Host: awscommon.SSHHost(
|
Host: awscommon.SSHHost(
|
||||||
ec2conn,
|
ec2conn,
|
||||||
b.config.SSHInterface,
|
b.config.SSHInterface,
|
||||||
b.config.Comm.SSHHost,
|
b.config.Comm.Host(),
|
||||||
),
|
),
|
||||||
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.RunConfig.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -79,7 +79,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
&stepDetachIso{},
|
&stepDetachIso{},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "ipaddress"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "ipaddress"),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
SSHPort: commPort,
|
SSHPort: commPort,
|
||||||
WinRMPort: commPort,
|
WinRMPort: commPort,
|
||||||
|
|
|
@ -88,7 +88,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
new(stepDropletInfo),
|
new(stepDropletInfo),
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "droplet_ip"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "droplet_ip"),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
new(common.StepProvision),
|
new(common.StepProvision),
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
&StepRun{},
|
&StepRun{},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: commHost(b.config.Comm.SSHHost),
|
Host: commHost(b.config.Comm.Host()),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
CustomConnect: map[string]multistep.Step{
|
CustomConnect: map[string]multistep.Step{
|
||||||
"docker": &StepConnectDocker{},
|
"docker": &StepConnectDocker{},
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
func commHost(host string) func(multistep.StateBag) (string, error) {
|
func commHost(host string) func(multistep.StateBag) (string, error) {
|
||||||
return func(state multistep.StateBag) (string, error) {
|
return func(state multistep.StateBag) (string, error) {
|
||||||
if host != "" {
|
if host != "" {
|
||||||
log.Printf("Using ssh_host value: %s", host)
|
log.Printf("Using host value: %s", host)
|
||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
containerId := state.Get("container_id").(string)
|
containerId := state.Get("container_id").(string)
|
||||||
|
|
|
@ -68,7 +68,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
},
|
},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "instance_ip"),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
WinRMConfig: winrmConfig,
|
WinRMConfig: winrmConfig,
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@ func CommHost(host string) func(multistep.StateBag) (string, error) {
|
||||||
|
|
||||||
// Skip IP auto detection if the configuration has an ssh host configured.
|
// Skip IP auto detection if the configuration has an ssh host configured.
|
||||||
if host != "" {
|
if host != "" {
|
||||||
log.Printf("Using ssh_host value: %s", host)
|
log.Printf("Using host value: %s", host)
|
||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (ret
|
||||||
&stepCreateLinode{client},
|
&stepCreateLinode{client},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: commHost(b.config.Comm.SSHHost),
|
Host: commHost(b.config.Comm.Host()),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
&common.StepProvision{},
|
&common.StepProvision{},
|
||||||
|
@ -104,7 +104,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (ret
|
||||||
func commHost(host string) func(multistep.StateBag) (string, error) {
|
func commHost(host string) func(multistep.StateBag) (string, error) {
|
||||||
return func(state multistep.StateBag) (string, error) {
|
return func(state multistep.StateBag) (string, error) {
|
||||||
if host != "" {
|
if host != "" {
|
||||||
log.Printf("Using ssh_host value: %s", host)
|
log.Printf("Using host value: %s", host)
|
||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
new(stepCreateServer),
|
new(stepCreateServer),
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "server_ip"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "server_ip"),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
&common.StepProvision{},
|
&common.StepProvision{},
|
||||||
|
|
|
@ -20,7 +20,7 @@ func CommHost(
|
||||||
sshipversion string) func(multistep.StateBag) (string, error) {
|
sshipversion string) func(multistep.StateBag) (string, error) {
|
||||||
return func(state multistep.StateBag) (string, error) {
|
return func(state multistep.StateBag) (string, error) {
|
||||||
if host != "" {
|
if host != "" {
|
||||||
log.Printf("Using ssh_host value: %s", host)
|
log.Printf("Using host value: %s", host)
|
||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
},
|
},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "instance_ip"),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
&common.StepProvision{},
|
&common.StepProvision{},
|
||||||
|
@ -133,7 +133,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
KeyName: fmt.Sprintf("packer-generated-key_%s", runID),
|
KeyName: fmt.Sprintf("packer-generated-key_%s", runID),
|
||||||
StepConnectSSH: &communicator.StepConnectSSH{
|
StepConnectSSH: &communicator.StepConnectSSH{
|
||||||
Config: &b.config.BuilderComm,
|
Config: &b.config.BuilderComm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "instance_ip"),
|
||||||
SSHConfig: b.config.BuilderComm.SSHConfigFunc(),
|
SSHConfig: b.config.BuilderComm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -166,7 +166,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
&stepCreateInstance{},
|
&stepCreateInstance{},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "instance_ip"),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
&common.StepProvision{},
|
&common.StepProvision{},
|
||||||
|
|
|
@ -67,7 +67,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
},
|
},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "instance_ip"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "instance_ip"),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
&common.StepProvision{},
|
&common.StepProvision{},
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
func CommHost(host string) func(multistep.StateBag) (string, error) {
|
func CommHost(host string) func(multistep.StateBag) (string, error) {
|
||||||
return func(state multistep.StateBag) (string, error) {
|
return func(state multistep.StateBag) (string, error) {
|
||||||
if host != "" {
|
if host != "" {
|
||||||
log.Printf("Using ssh_host value: %s", host)
|
log.Printf("Using host value: %s", host)
|
||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
vmName := state.Get("vmName").(string)
|
vmName := state.Get("vmName").(string)
|
||||||
|
|
|
@ -43,7 +43,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
new(stepCreateServer),
|
new(stepCreateServer),
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "server_ip"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "server_ip"),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
&common.StepProvision{},
|
&common.StepProvision{},
|
||||||
|
|
|
@ -652,7 +652,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
steps = append(steps,
|
steps = append(steps,
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: commHost(b.config.Comm.SSHHost),
|
Host: commHost(b.config.Comm.Host()),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
SSHPort: commPort,
|
SSHPort: commPort,
|
||||||
WinRMPort: commPort,
|
WinRMPort: commPort,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
func commHost(host string) func(multistep.StateBag) (string, error) {
|
func commHost(host string) func(multistep.StateBag) (string, error) {
|
||||||
return func(state multistep.StateBag) (string, error) {
|
return func(state multistep.StateBag) (string, error) {
|
||||||
if host != "" {
|
if host != "" {
|
||||||
log.Printf("Using ssh_host value: %s", host)
|
log.Printf("Using host value: %s", host)
|
||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
new(stepServerInfo),
|
new(stepServerInfo),
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: communicator.CommHost(b.config.Comm.SSHHost, "server_ip"),
|
Host: communicator.CommHost(b.config.Comm.Host(), "server_ip"),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
new(common.StepProvision),
|
new(common.StepProvision),
|
||||||
|
|
|
@ -67,7 +67,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
&StepCreateSourceMachine{},
|
&StepCreateSourceMachine{},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &config.Comm,
|
Config: &config.Comm,
|
||||||
Host: commHost(b.config.Comm.SSHHost),
|
Host: commHost(b.config.Comm.Host()),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
&common.StepProvision{},
|
&common.StepProvision{},
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
func commHost(host string) func(multistep.StateBag) (string, error) {
|
func commHost(host string) func(multistep.StateBag) (string, error) {
|
||||||
return func(state multistep.StateBag) (string, error) {
|
return func(state multistep.StateBag) (string, error) {
|
||||||
if host != "" {
|
if host != "" {
|
||||||
log.Printf("Using ssh_host value: %s", host)
|
log.Printf("Using host value: %s", host)
|
||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
},
|
},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: common.CommHost(b.config.Comm.SSHHost),
|
Host: common.CommHost(b.config.Comm.Host()),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
&packerCommon.StepProvision{},
|
&packerCommon.StepProvision{},
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
},
|
},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: common.CommHost(b.config.Comm.SSHHost),
|
Host: common.CommHost(b.config.Comm.Host()),
|
||||||
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
SSHConfig: b.config.Comm.SSHConfigFunc(),
|
||||||
},
|
},
|
||||||
&packerCommon.StepProvision{},
|
&packerCommon.StepProvision{},
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
func CommHost(host string, statebagKey string) func(multistep.StateBag) (string, error) {
|
func CommHost(host string, statebagKey string) func(multistep.StateBag) (string, error) {
|
||||||
return func(state multistep.StateBag) (string, error) {
|
return func(state multistep.StateBag) (string, error) {
|
||||||
if host != "" {
|
if host != "" {
|
||||||
log.Printf("Using ssh_host value: %s", host)
|
log.Printf("Using host value: %s", host)
|
||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
ipAddress, hasIP := state.Get(statebagKey).(string)
|
ipAddress, hasIP := state.Get(statebagKey).(string)
|
||||||
|
|
Loading…
Reference in New Issue