Merge pull request #67 from stgraber/master

generator: Also prepend host entry on LXD
This commit is contained in:
Christian Brauner 2018-03-14 19:56:08 +01:00 committed by GitHub
commit b8d4fca5ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,6 +80,11 @@ func (g HostsGenerator) RunLXD(cacheDir, sourceDir string, img *image.LXDImage,
// Replace hostname with placeholder
content = []byte(strings.Replace(string(content), "distrobuilder", "{{ container.name }}", -1))
// Add a new line if needed
if !strings.Contains(string(content), "{{ container.name }}") {
content = append([]byte("127.0.1.1\t{{ container.name }}\n"), content...)
}
// Write the template
err = ioutil.WriteFile(filepath.Join(templateDir, "hosts.tpl"), content, 0644)
if err != nil {