Signed-off-by: James Turnbull <[email protected]>
---
 CHANGELOG            |    2 ++
 lib/facter/uptime.rb |   11 +++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 lib/facter/uptime.rb

diff --git a/CHANGELOG b/CHANGELOG
index a714e81..79ccb15 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 1.5.3:
+    Added uptime fact
+ 
     Fixed #1791 - support for virtual fact on Solaris 10
 
     Fixed #1793 - Added more Solaris 10 facts
diff --git a/lib/facter/uptime.rb b/lib/facter/uptime.rb
new file mode 100644
index 0000000..7533d3b
--- /dev/null
+++ b/lib/facter/uptime.rb
@@ -0,0 +1,11 @@
+Facter.add(:uptime) do
+    confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE 
SLES Debian Ubuntu Gentoo AIX}
+    setcode do
+        time = Facter::Util::Resolution.exec('uptime')
+            if time =~ /up\s*(\d+\s\w+)/
+                 $1
+            else
+                 "unknown"
+            end
+    end
+end
-- 
1.6.0.6


--~--~---------~--~----~------------~-------~--~----~
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