saltstack/salt — pull request #1063 by fatbox (2012-04-08 18:41:23+00:00)
Title: Ensure hosts.add_host isn't leaving duplicate entries around

Given a state entry like the following:

```
host-staging-web:
host:
- present
- ip: 10.102.130.100
- names:
- staging-web.fqdn.com
- staging-web
- alt-staging-hostname
```

You'd end up with three different entries in your hosts file:

```
10.102.130.100	staging-web.fqdn.com
10.102.130.100	staging-web.fqdn.com	staging-web
10.102.130.100	staging-web.fqdn.com	staging-web	alt-staging-hostname
```

This corrects it by removing the previous line before appending the
newly crafted on, and adds tests to prove it.