saltstack/salt — Issue #403: add_host() does not add line break when the host already exists in /etc/hosts
Author: zhenghouzz
Created: 2011-12-28 20:07:58+00:00
State: open

When adding a new alias to a known host in /etc/hosts, the function add_host() within modules/hosts.py does not append a line break the the newline variable. So in the new /etc/hosts file, multiple lines will be cancatenated together.

Also there are other issues (or needed improvement) on this function:

* It does not check if the new alias already exist for the host, therefore can create duplicated aliases.
* It would be better to make sure the FQDN name is listed as the first entry after IP, then hostname aliases. I remember I have read somewhere that some FQDN tools need this to be the case.