]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
How many of our hosts have a broken /etc/hosts ?
authorStephen Gran <steve@lobefin.net>
Mon, 29 Jun 2009 07:03:30 +0000 (08:03 +0100)
committerStephen Gran <steve@lobefin.net>
Mon, 29 Jun 2009 07:03:30 +0000 (08:03 +0100)
Signed-off-by: Stephen Gran <steve@lobefin.net>
facts/hosts.rb [new file with mode: 0644]

diff --git a/facts/hosts.rb b/facts/hosts.rb
new file mode 100644 (file)
index 0000000..3e6b2d9
--- /dev/null
@@ -0,0 +1,19 @@
+Facter.add("brokenhosts") do
+       confine :kernel => :linux
+       brokenhosts = "true"
+       if FileTest.exist?("/etc/hosts")
+               IO.foreach("/etc/hosts") do |x|
+                       x.split.each do |y|
+                               if y == fqdn
+                                       brokenhosts = "false"
+                                       break
+                               end
+                       end
+               end
+       end
+       setcode do
+               brokenhosts == "true"
+       end
+end
+
+