(PUP-2289) Fix host type newline validation

This commit fix the first bug reported on PUP-2289.
This is done by implementing validation of newlines
on ip, hostname, comments and host_aliases, making
sure we don't have any \n or \r.

The bug and fix is on host resource type.

Bellow is the problem description:

If the ip address or hostname or host_aliases
use double quoting and have \n, Puppet Will:

1 - Write the wrong entry on /etc/hosts with the linebreak.
This leads to a corrupted /etc/hosts, with some lines
that could not be parsed by the host resource provider
parsed.

This leads to second bug on the second puppet run,
where it will have error after failing to parse the file,
but wipes out the /etc/hosts file, writing only the information
on that file that is managed by puppet.

How to reproduce it:
1- backup /etc/hosts
cp /etc/hosts /etc/hosts.orig
2 - Create the script to reproduce the bug 01
cat <<EOF > /tmp/hostsbug.pp
host {'hostsbug': ip => "10.10.12.1\n" }
EOF
The same apply if you have newline on hostname, hostaliases or comment.
3 - Run the script the first time to reproduce bug 01.
puppet apply /tmp/hostsbug.pp
4 - Check /etc/hosts
cat /etc/hosts

Leonardo Rodrigues de Mello

PUP-2289 Fix bug on host resource provider

The host resource provider parsed file wipes
all entries of etc/hosts file if it gets one
entry that could not be parsed.

This commits fix this problem, considering that
incomplete lines are :text_lines. This is the same
solution that was used for mount resource provider.

I  had checked that etc/hosts ignores invalid entries
at least on linux, tested on rhel 5, 6, 7 and debian 5,6,7 and
fedora 20.

It would be great if someone could test it on other platforms.

Thanks
Leonardo Rodrigues  de Mello

Fixes as required on the pull request