mirror of
https://github.com/costela/docker-etchosts.git
synced 2025-05-10 17:35:41 +02:00
also ignore entries without ip during writing
This commit is contained in:
parent
06d16b7b51
commit
b6d9115583
1 changed files with 1 additions and 1 deletions
|
@ -88,7 +88,7 @@ func writeToEtcHosts(ipsToNames ipsToNamesMap, config ConfigSpec) error {
|
|||
}
|
||||
|
||||
func writeEntryWithBanner(tmp io.Writer, ip string, names []string) error {
|
||||
if len(names) > 0 {
|
||||
if ip != "" && len(names) > 0 {
|
||||
log.Debugf("writing entry for %s (%s)", ip, names)
|
||||
if _, err := fmt.Fprintf(tmp, "%s\n%s\t%s\n", banner, ip, strings.Join(names, " ")); err != nil {
|
||||
return fmt.Errorf("error writing entry for %s: %s", ip, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue