fmt
This commit is contained in:
parent
e84e5e4f2c
commit
5fac6c79c4
@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/mitchellh/packer/common/uuid"
|
||||
"github.com/mitchellh/packer/common"
|
||||
"github.com/mitchellh/packer/common/uuid"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
|
@ -170,13 +170,13 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
|
||||
Description: c.Description,
|
||||
Disks: []*compute.AttachedDisk{
|
||||
&compute.AttachedDisk{
|
||||
Type: "PERSISTENT",
|
||||
Mode: "READ_WRITE",
|
||||
Kind: "compute#attachedDisk",
|
||||
Boot: true,
|
||||
Type: "PERSISTENT",
|
||||
Mode: "READ_WRITE",
|
||||
Kind: "compute#attachedDisk",
|
||||
Boot: true,
|
||||
AutoDelete: true,
|
||||
InitializeParams: &compute.AttachedDiskInitializeParams{
|
||||
SourceImage: image.SelfLink,
|
||||
SourceImage: image.SelfLink,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -27,7 +27,7 @@ func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*gossh.ClientConf
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
auth = append(auth, gossh.PublicKeys(signer))
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,8 @@ package iso
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
vmwcommon "github.com/mitchellh/packer/builder/vmware/common"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
@ -47,13 +47,13 @@ func CheckUnusedConfig(md *mapstructure.Metadata) *packer.MultiError {
|
||||
|
||||
// ChooseString returns the first non-empty value.
|
||||
func ChooseString(vals ...string) string {
|
||||
for _, el := range vals {
|
||||
if el != "" {
|
||||
return el
|
||||
}
|
||||
}
|
||||
for _, el := range vals {
|
||||
if el != "" {
|
||||
return el
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
return ""
|
||||
}
|
||||
|
||||
// DecodeConfig is a helper that handles decoding raw configuration using
|
||||
|
@ -31,7 +31,7 @@ func TestCheckUnusedConfig(t *testing.T) {
|
||||
|
||||
func TestChooseString(t *testing.T) {
|
||||
cases := []struct {
|
||||
Input []string
|
||||
Input []string
|
||||
Output string
|
||||
}{
|
||||
{
|
||||
|
@ -1,27 +1,27 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"log"
|
||||
"code.google.com/p/go.crypto/ssh"
|
||||
"log"
|
||||
)
|
||||
|
||||
// An implementation of ssh.KeyboardInteractiveChallenge that simply sends
|
||||
// back the password for all questions. The questions are logged.
|
||||
func PasswordKeyboardInteractive (password string) (ssh.KeyboardInteractiveChallenge) {
|
||||
return func (user, instruction string, questions []string, echos []bool) ([]string, error) {
|
||||
func PasswordKeyboardInteractive(password string) ssh.KeyboardInteractiveChallenge {
|
||||
return func(user, instruction string, questions []string, echos []bool) ([]string, error) {
|
||||
log.Printf("Keyboard interactive challenge: ")
|
||||
log.Printf("-- User: %s", user)
|
||||
log.Printf("-- Instructions: %s", instruction)
|
||||
for i, question := range questions {
|
||||
log.Printf("-- Question %d: %s", i+1, question)
|
||||
}
|
||||
|
||||
|
||||
// Just send the password back for all questions
|
||||
answers := make([]string, len(questions))
|
||||
for i, _ := range answers {
|
||||
answers[i] = string(password)
|
||||
}
|
||||
|
||||
|
||||
return answers, nil
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ func TestPostProcessor_PostProcess(t *testing.T) {
|
||||
p := &PostProcessor{Driver: driver}
|
||||
artifact := &packer.MockArtifact{
|
||||
BuilderIdValue: dockerimport.BuilderId,
|
||||
IdValue: "foo/bar",
|
||||
IdValue: "foo/bar",
|
||||
}
|
||||
|
||||
result, keep, err := p.PostProcess(testUi(), artifact)
|
||||
@ -64,7 +64,7 @@ func TestPostProcessor_PostProcess_portInName(t *testing.T) {
|
||||
p := &PostProcessor{Driver: driver}
|
||||
artifact := &packer.MockArtifact{
|
||||
BuilderIdValue: dockerimport.BuilderId,
|
||||
IdValue: "localhost:5000/foo/bar",
|
||||
IdValue: "localhost:5000/foo/bar",
|
||||
}
|
||||
|
||||
result, keep, err := p.PostProcess(testUi(), artifact)
|
||||
@ -91,7 +91,7 @@ func TestPostProcessor_PostProcess_tags(t *testing.T) {
|
||||
p := &PostProcessor{Driver: driver}
|
||||
artifact := &packer.MockArtifact{
|
||||
BuilderIdValue: dockerimport.BuilderId,
|
||||
IdValue: "hashicorp/ubuntu:precise",
|
||||
IdValue: "hashicorp/ubuntu:precise",
|
||||
}
|
||||
|
||||
result, keep, err := p.PostProcess(testUi(), artifact)
|
||||
|
@ -20,19 +20,19 @@ import (
|
||||
type Config struct {
|
||||
common.PackerConfig `mapstructure:",squash"`
|
||||
|
||||
ConfigTemplate string `mapstructure:"config_template"`
|
||||
ExecuteCommand string `mapstructure:"execute_command"`
|
||||
InstallCommand string `mapstructure:"install_command"`
|
||||
Json map[string]interface{}
|
||||
NodeName string `mapstructure:"node_name"`
|
||||
PreventSudo bool `mapstructure:"prevent_sudo"`
|
||||
RunList []string `mapstructure:"run_list"`
|
||||
ServerUrl string `mapstructure:"server_url"`
|
||||
SkipCleanClient bool `mapstructure:"skip_clean_client"`
|
||||
SkipCleanNode bool `mapstructure:"skip_clean_node"`
|
||||
SkipInstall bool `mapstructure:"skip_install"`
|
||||
StagingDir string `mapstructure:"staging_directory"`
|
||||
ValidationKeyPath string `mapstructure:"validation_key_path"`
|
||||
ConfigTemplate string `mapstructure:"config_template"`
|
||||
ExecuteCommand string `mapstructure:"execute_command"`
|
||||
InstallCommand string `mapstructure:"install_command"`
|
||||
Json map[string]interface{}
|
||||
NodeName string `mapstructure:"node_name"`
|
||||
PreventSudo bool `mapstructure:"prevent_sudo"`
|
||||
RunList []string `mapstructure:"run_list"`
|
||||
ServerUrl string `mapstructure:"server_url"`
|
||||
SkipCleanClient bool `mapstructure:"skip_clean_client"`
|
||||
SkipCleanNode bool `mapstructure:"skip_clean_node"`
|
||||
SkipInstall bool `mapstructure:"skip_install"`
|
||||
StagingDir string `mapstructure:"staging_directory"`
|
||||
ValidationKeyPath string `mapstructure:"validation_key_path"`
|
||||
ValidationClientName string `mapstructure:"validation_client_name"`
|
||||
|
||||
tpl *packer.ConfigTemplate
|
||||
@ -43,9 +43,9 @@ type Provisioner struct {
|
||||
}
|
||||
|
||||
type ConfigTemplate struct {
|
||||
NodeName string
|
||||
ServerUrl string
|
||||
ValidationKeyPath string
|
||||
NodeName string
|
||||
ServerUrl string
|
||||
ValidationKeyPath string
|
||||
ValidationClientName string
|
||||
}
|
||||
|
||||
@ -265,9 +265,9 @@ func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, nodeN
|
||||
}
|
||||
|
||||
configString, err := p.config.tpl.Process(tpl, &ConfigTemplate{
|
||||
NodeName: nodeName,
|
||||
ServerUrl: serverUrl,
|
||||
ValidationKeyPath: remoteKeyPath,
|
||||
NodeName: nodeName,
|
||||
ServerUrl: serverUrl,
|
||||
ValidationKeyPath: remoteKeyPath,
|
||||
ValidationClientName: validationClientName,
|
||||
})
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user