+1,
To support SLES/SLED/OpenSuSE ...

+    elsif FileTest.exists?("/etc/SuSE-version")
+      "suse"

Cheers
Mike

On 9/06/11 6:43 AM, Adrien Thebo wrote:
Added osfamily fact to determine if a given operating system is a
derivative of a common operating system.

Signed-off-by: Adrien Thebo<[email protected]>
---
Local-branch: ticket/master/6792
  lib/facter/osfamily.rb |   24 ++++++++++++++++++++++++
  1 files changed, 24 insertions(+), 0 deletions(-)
  create mode 100644 lib/facter/osfamily.rb

diff --git a/lib/facter/osfamily.rb b/lib/facter/osfamily.rb
new file mode 100644
index 0000000..b580034
--- /dev/null
+++ b/lib/facter/osfamily.rb
@@ -0,0 +1,24 @@
+# Fact: osfamily
+#
+# Purpose: Returns the operating system
+#
+# Resolution:
+#   On Redhat and derivatives, returns redhat
+#   On Debian and derivatives, returns debian
+#   Else, returns the kernel
+#
+# Caveats:
+#
+
+Facter.add(:osfamily) do
+
+  setcode do
+    if FileTest.exists?("/etc/redhat-release")
+      "redhat"
+    elsif FileTest.exists?("/etc/debian_version")
+      "debian"
+    else
+      Facter.kernel
+    end
+  end
+end

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to