components/ruby/facter/patches/facter-03-FACT-658.patch
author Patrick Einheber <patrick.einheber@oracle.com>
Wed, 27 Apr 2016 14:55:10 -0700
changeset 5860 afd31ba91ee9
parent 2068 4e371f01e40f
permissions -rw-r--r--
23146903 Puppet and OpenStack modules need modification notices
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2068
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     1
Patch for FACT-658 facter doesn't parse gnu uptime output
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
     2
Upstream bug: https://tickets.puppetlabs.com/browse/FACT-658
5860
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
     3
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
     4
--- facter-2.4.6/lib/facter/util/uptime.rb.orig	2016-04-19 15:19:02.924027657 -0700
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
     5
+++ facter-2.4.6/lib/facter/util/uptime.rb	2016-04-19 15:20:09.128836906 -0700
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
     6
@@ -1,3 +1,7 @@
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
     7
+#######################################################################
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
     8
+# Oracle has modified the originally distributed contents of this file.
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
     9
+#######################################################################
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
    10
+
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
    11
 require 'time'
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
    12
 
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
    13
 # A module to gather uptime facts
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
    14
@@ -78,6 +82,14 @@
2068
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    15
   end
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    16
 
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    17
   def self.uptime_executable_cmd
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    18
-    "uptime"
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    19
+    if Facter.value(:kernel) == 'SunOS'
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    20
+      # Facter doesn't work with gnu uptime
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    21
+      # force use of /usr/bin/uptime
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    22
+      # in case user PATH has /usr/gnu/bin
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    23
+      # before /usr/bin
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    24
+      "/usr/bin/uptime"
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    25
+    else
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    26
+      "uptime"
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    27
+    end
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    28
   end
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    29
 end