projects
/
mirror
/
dsa-puppet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e3a3b6c
)
How many of our hosts have a broken /etc/hosts ?
author
Stephen Gran
<steve@lobefin.net>
Mon, 29 Jun 2009 07:03:30 +0000
(08:03 +0100)
committer
Stephen 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]
patch
|
blob
diff --git a/facts/hosts.rb
b/facts/hosts.rb
new file mode 100644
(file)
index 0000000..
3e6b2d9
--- /dev/null
+++ b/
facts/hosts.rb
@@ -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
+
+