From 8efdc769db2e144fe61eccbb1663a1c9594b09ab Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Wed, 17 Nov 2010 22:59:47 +0100 Subject: (#5274) Tests for hostprovider removes comments I noticed that the hostprovider will remove all inline comments from the /etc/hosts file, when puppet updates at least one entry. Puppet will also remove comments from entries, the user doesnt want to manage with puppet. To split up changes a bit this commit will only introduce tests for the host type and the hostprovider. A few will fail, indicating the bug: The hostprovider parses all entries and builds a hash. When building the recordhash all comments are discarded. When puppet has to update at least one entry it uses the to_line function to convert the record hash back to a file. Because the comments are not stored in the hash, they cannot be written back to the file. --- test/data/providers/host/parsed/valid_hosts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/data/providers/host/parsed/valid_hosts (limited to 'test/data/providers') diff --git a/test/data/providers/host/parsed/valid_hosts b/test/data/providers/host/parsed/valid_hosts new file mode 100644 index 000000000..de5caf740 --- /dev/null +++ b/test/data/providers/host/parsed/valid_hosts @@ -0,0 +1,14 @@ +# Some leading comment, that should be ignored +# The next line is empty so it should be ignored + +::1 localhost + +# We now try another delimiter: Several tabs +127.0.0.1 localhost + +# No test trailing spaces +10.0.0.1 host1 + +# Ok its time to test aliases +2001:252:0:1::2008:8 ipv6host alias1 +192.168.0.1 ipv4host alias2 alias3 -- cgit