Merge pull request #65 from bcwaldon/hosts-newline
fix(manage_etc_hosts): Append newline to /etc/hosts
This commit is contained in:
commit
8a7df360ac
@ -22,7 +22,7 @@ func generateEtcHosts(option string) (out string, err error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%s %s", DefaultIpv4Address, hostname), nil
|
return fmt.Sprintf("%s %s\n", DefaultIpv4Address, hostname), nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ func TestEtcHostsWrittenToDisk(t *testing.T) {
|
|||||||
t.Fatalf("Unable to read OS hostname: %v", err)
|
t.Fatalf("Unable to read OS hostname: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
expect := fmt.Sprintf("%s %s", DefaultIpv4Address, hostname)
|
expect := fmt.Sprintf("%s %s\n", DefaultIpv4Address, hostname)
|
||||||
|
|
||||||
if string(contents) != expect {
|
if string(contents) != expect {
|
||||||
t.Fatalf("File has incorrect contents")
|
t.Fatalf("File has incorrect contents")
|
||||||
|
Loading…
Reference in New Issue
Block a user