Commit aa143a33 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer: TargettedUi properly targets machine-readable data

parent 89be12ae
......@@ -140,8 +140,8 @@ func (u *TargettedUi) Error(message string) {
}
func (u *TargettedUi) Machine(t string, args ...string) {
// Just pass it through for now.
u.Ui.Machine(t, args...)
// Prefix in the target, then pass through
u.Ui.Machine(fmt.Sprintf("%s,%s", u.Target, t), args...)
}
func (u *TargettedUi) prefixLines(arrow bool, message string) string {
......
......@@ -41,21 +41,21 @@ func TestTargettedUi(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
bufferUi := testUi()
TargettedUi := &TargettedUi{
targettedUi := &TargettedUi{
Target: "foo",
Ui: bufferUi,
}
TargettedUi.Say("foo")
targettedUi.Say("foo")
assert.Equal(readWriter(bufferUi), "==> foo: foo\n", "should have prefix")
TargettedUi.Message("foo")
targettedUi.Message("foo")
assert.Equal(readWriter(bufferUi), " foo: foo\n", "should have prefix")
TargettedUi.Error("bar")
targettedUi.Error("bar")
assert.Equal(readWriter(bufferUi), "==> foo: bar\n", "should have prefix")
TargettedUi.Say("foo\nbar")
targettedUi.Say("foo\nbar")
assert.Equal(readWriter(bufferUi), "==> foo: foo\n==> foo: bar\n", "should multiline")
}
......
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