builder/amazonebs, command/build: use new UI interface
This commit is contained in:
parent
2788d29bd1
commit
33f8d29571
|
@ -26,7 +26,7 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) StepAction {
|
||||||
keyring := &ssh.SimpleKeychain{}
|
keyring := &ssh.SimpleKeychain{}
|
||||||
err := keyring.AddPEMKey(privateKey)
|
err := keyring.AddPEMKey(privateKey)
|
||||||
if err != nil {
|
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
|
return StepHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) StepAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error("Error connecting to SSH: %s", err.Error())
|
ui.Error(fmt.Sprintf("Error connecting to SSH: %s", err))
|
||||||
return StepHalt
|
return StepHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package amazonebs
|
package amazonebs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/mitchellh/goamz/ec2"
|
"github.com/mitchellh/goamz/ec2"
|
||||||
"github.com/mitchellh/packer/packer"
|
"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
|
// 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 := make(map[string]string)
|
||||||
amis[config.Region] = createResp.ImageId
|
amis[config.Region] = createResp.ImageId
|
||||||
state["amis"] = amis
|
state["amis"] = amis
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (s *stepKeyPair) Cleanup(state map[string]interface{}) {
|
||||||
ui.Say("Deleting temporary keypair...")
|
ui.Say("Deleting temporary keypair...")
|
||||||
_, err := ec2conn.DeleteKeyPair(s.keyName)
|
_, err := ec2conn.DeleteKeyPair(s.keyName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error(
|
ui.Error(fmt.Sprintf(
|
||||||
"Error cleaning up keypair. Please delete the key manually: %s", s.keyName)
|
"Error cleaning up keypair. Please delete the key manually: %s", s.keyName))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ func (Command) Run(env packer.Environment, args []string) int {
|
||||||
log.Printf("Reading template: %s", args[0])
|
log.Printf("Reading template: %s", args[0])
|
||||||
tplData, err := ioutil.ReadFile(args[0])
|
tplData, err := ioutil.ReadFile(args[0])
|
||||||
if err != nil {
|
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
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ func (Command) Run(env packer.Environment, args []string) int {
|
||||||
log.Println("Parsing template...")
|
log.Println("Parsing template...")
|
||||||
tpl, err := packer.ParseTemplate(tplData)
|
tpl, err := packer.ParseTemplate(tplData)
|
||||||
if err != nil {
|
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
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ func (Command) Run(env packer.Environment, args []string) int {
|
||||||
log.Printf("Creating build: %s", buildName)
|
log.Printf("Creating build: %s", buildName)
|
||||||
build, err := tpl.Build(buildName, components)
|
build, err := tpl.Build(buildName, components)
|
||||||
if err != nil {
|
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
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ func (Command) Run(env packer.Environment, args []string) int {
|
||||||
// Output all the artifacts
|
// Output all the artifacts
|
||||||
env.Ui().Say("\n==> The build completed! The artifacts created were:")
|
env.Ui().Say("\n==> The build completed! The artifacts created were:")
|
||||||
for name, artifact := range artifacts {
|
for name, artifact := range artifacts {
|
||||||
env.Ui().Say("--> %s:", name)
|
env.Ui().Say(fmt.Sprintf("--> %s:", name))
|
||||||
env.Ui().Say(artifact.String())
|
env.Ui().Say(artifact.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue