builder/amazonebs, command/build: use new UI interface

This commit is contained in:
Mitchell Hashimoto 2013-05-27 15:15:42 -07:00
parent 2788d29bd1
commit 33f8d29571
4 changed files with 10 additions and 9 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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))
}
}

View File

@ -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())
}