Merge pull request #8308 from alrs/prune-dead-linode-func

builder/linode: remove unused sshConfig() and associated import
pull/8315/head
Adrien Delorme 7 years ago committed by GitHub
commit c935eb1435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,6 +6,7 @@ import (
"context"
"errors"
"fmt"
"log"
"github.com/hashicorp/packer/common"
"github.com/linode/linodego"
@ -96,3 +97,18 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (ret
return artifact, nil
}
func commHost(host string) func(multistep.StateBag) (string, error) {
return func(state multistep.StateBag) (string, error) {
if host != "" {
log.Printf("Using ssh_host value: %s", host)
return host, nil
}
instance := state.Get("instance").(*linodego.Instance)
if len(instance.IPv4) == 0 {
return "", fmt.Errorf("Linode instance %d has no IPv4 addresses!", instance.ID)
}
return instance.IPv4[0].String(), nil
}
}

@ -1,35 +0,0 @@
package linode
import (
"fmt"
"log"
"github.com/hashicorp/packer/helper/multistep"
"github.com/linode/linodego"
"golang.org/x/crypto/ssh"
)
func commHost(host string) func(multistep.StateBag) (string, error) {
return func(state multistep.StateBag) (string, error) {
if host != "" {
log.Printf("Using ssh_host value: %s", host)
return host, nil
}
instance := state.Get("instance").(*linodego.Instance)
if len(instance.IPv4) == 0 {
return "", fmt.Errorf("Linode instance %d has no IPv4 addresses!", instance.ID)
}
return instance.IPv4[0].String(), nil
}
}
func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
return &ssh.ClientConfig{
User: "root",
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
Auth: []ssh.AuthMethod{
ssh.Password(state.Get("root_pass").(string)),
},
}, nil
}
Loading…
Cancel
Save