Commit 8dfe78dd authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer: Log UI output

parent dfc332f9
...@@ -23,7 +23,7 @@ type config struct { ...@@ -23,7 +23,7 @@ type config struct {
SourceAmi string `mapstructure:"source_ami"` SourceAmi string `mapstructure:"source_ami"`
InstanceType string `mapstructure:"instance_type"` InstanceType string `mapstructure:"instance_type"`
SSHUsername string `mapstructure:"ssh_username"` SSHUsername string `mapstructure:"ssh_username"`
SSHPort int `mapstructure:"ssh_port"` SSHPort int `mapstructure:"ssh_port"`
// Configuration of the resulting AMI // Configuration of the resulting AMI
AMIName string `mapstructure:"ami_name"` AMIName string `mapstructure:"ami_name"`
......
...@@ -3,6 +3,7 @@ package packer ...@@ -3,6 +3,7 @@ package packer
import ( import (
"fmt" "fmt"
"io" "io"
"log"
) )
// The Ui interface handles all communication for Packer with the outside // The Ui interface handles all communication for Packer with the outside
...@@ -21,14 +22,18 @@ type ReaderWriterUi struct { ...@@ -21,14 +22,18 @@ type ReaderWriterUi struct {
} }
func (rw *ReaderWriterUi) Say(format string, a ...interface{}) { func (rw *ReaderWriterUi) Say(format string, a ...interface{}) {
_, err := fmt.Fprintf(rw.Writer, format+"\n", a...) output := fmt.Sprintf(format, a...)
log.Printf("ui: %s", output)
_, err := fmt.Fprint(rw.Writer, output+"\n")
if err != nil { if err != nil {
panic(err) panic(err)
} }
} }
func (rw *ReaderWriterUi) Error(format string, a ...interface{}) { func (rw *ReaderWriterUi) Error(format string, a ...interface{}) {
_, err := fmt.Fprintf(rw.Writer, format+"\n", a...) output := fmt.Sprintf(format, a...)
log.Printf("ui error: %s", output)
_, err := fmt.Fprint(rw.Writer, output+"\n")
if err != nil { if err != nil {
panic(err) panic(err)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment