From 33f8d29571b68ddd7fa9a785ab486026681712f9 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 27 May 2013 15:15:42 -0700 Subject: [PATCH] builder/amazonebs, command/build: use new UI interface --- builder/amazonebs/step_connect_ssh.go | 4 ++-- builder/amazonebs/step_create_ami.go | 3 ++- builder/amazonebs/step_keypair.go | 4 ++-- command/build/command.go | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/builder/amazonebs/step_connect_ssh.go b/builder/amazonebs/step_connect_ssh.go index f3a9544d2..92eae374c 100644 --- a/builder/amazonebs/step_connect_ssh.go +++ b/builder/amazonebs/step_connect_ssh.go @@ -26,7 +26,7 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) StepAction { keyring := &ssh.SimpleKeychain{} err := keyring.AddPEMKey(privateKey) if err != nil { - ui.Say("Error setting up SSH config: %s", err.Error()) + ui.Say(fmt.Sprintf("Error setting up SSH config: %s", err)) return StepHalt } @@ -58,7 +58,7 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) StepAction { } if err != nil { - ui.Error("Error connecting to SSH: %s", err.Error()) + ui.Error(fmt.Sprintf("Error connecting to SSH: %s", err)) return StepHalt } diff --git a/builder/amazonebs/step_create_ami.go b/builder/amazonebs/step_create_ami.go index e0a187911..60e83b60d 100644 --- a/builder/amazonebs/step_create_ami.go +++ b/builder/amazonebs/step_create_ami.go @@ -1,6 +1,7 @@ package amazonebs import ( + "fmt" "github.com/mitchellh/goamz/ec2" "github.com/mitchellh/packer/packer" ) @@ -27,7 +28,7 @@ func (s *stepCreateAMI) Run(state map[string]interface{}) StepAction { } // Set the AMI ID in the state - ui.Say("AMI: %s", createResp.ImageId) + ui.Say(fmt.Sprintf("AMI: %s", createResp.ImageId)) amis := make(map[string]string) amis[config.Region] = createResp.ImageId state["amis"] = amis diff --git a/builder/amazonebs/step_keypair.go b/builder/amazonebs/step_keypair.go index 47eb361cd..10ae3a45c 100644 --- a/builder/amazonebs/step_keypair.go +++ b/builder/amazonebs/step_keypair.go @@ -48,7 +48,7 @@ func (s *stepKeyPair) Cleanup(state map[string]interface{}) { ui.Say("Deleting temporary keypair...") _, err := ec2conn.DeleteKeyPair(s.keyName) if err != nil { - ui.Error( - "Error cleaning up keypair. Please delete the key manually: %s", s.keyName) + ui.Error(fmt.Sprintf( + "Error cleaning up keypair. Please delete the key manually: %s", s.keyName)) } } diff --git a/command/build/command.go b/command/build/command.go index dd397dfb9..6132787ce 100644 --- a/command/build/command.go +++ b/command/build/command.go @@ -20,7 +20,7 @@ func (Command) Run(env packer.Environment, args []string) int { log.Printf("Reading template: %s", args[0]) tplData, err := ioutil.ReadFile(args[0]) if err != nil { - env.Ui().Error("Failed to read template file: %s", err.Error()) + env.Ui().Error(fmt.Sprintf("Failed to read template file: %s", err)) return 1 } @@ -28,7 +28,7 @@ func (Command) Run(env packer.Environment, args []string) int { log.Println("Parsing template...") tpl, err := packer.ParseTemplate(tplData) if err != nil { - env.Ui().Error("Failed to parse template: %s", err.Error()) + env.Ui().Error(fmt.Sprintf("Failed to parse template: %s", err)) return 1 } @@ -46,7 +46,7 @@ func (Command) Run(env packer.Environment, args []string) int { log.Printf("Creating build: %s", buildName) build, err := tpl.Build(buildName, components) if err != nil { - env.Ui().Error("Failed to create build '%s': \n\n%s", buildName, err.Error()) + env.Ui().Error(fmt.Sprintf("Failed to create build '%s': \n\n%s", buildName, err)) return 1 } @@ -93,7 +93,7 @@ func (Command) Run(env packer.Environment, args []string) int { // Output all the artifacts env.Ui().Say("\n==> The build completed! The artifacts created were:") for name, artifact := range artifacts { - env.Ui().Say("--> %s:", name) + env.Ui().Say(fmt.Sprintf("--> %s:", name)) env.Ui().Say(artifact.String()) }