first stab at plugins-in-modules style
[mirror/dsa-puppet.git] / modules / debian-org / lib / facter / hosts.rb
diff --git a/modules/debian-org/lib/facter/hosts.rb b/modules/debian-org/lib/facter/hosts.rb
new file mode 100644 (file)
index 0000000..b55c43b
--- /dev/null
@@ -0,0 +1,18 @@
+Facter.add("brokenhosts") do
+       brokenhosts = "true"
+       if FileTest.exist?("/etc/hosts")
+               IO.foreach("/etc/hosts") do |x|
+                       x.split.each do |y|
+                               if y == Facter.value("fqdn")
+                                       brokenhosts = "false"
+                                       break
+                               end
+                       end
+               end
+       end
+       setcode do
+               brokenhosts == "true"
+       end
+end
+
+