components/ruby/facter/patches/facter-04-FACT-660.patch
author Patrick Einheber <patrick.einheber@oracle.com>
Wed, 27 Apr 2016 14:55:10 -0700
changeset 5860 afd31ba91ee9
parent 2068 4e371f01e40f
child 6136 428f5dba7242
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-660 Facter on Solaris 11.2+ should report if zones are supported
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-660
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/solaris_zones.rb.orig	2016-04-19 15:21:42.808586315 -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/solaris_zones.rb	2016-04-19 15:22:05.762477352 -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 'facter/util/resolution'
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
 module Facter
afd31ba91ee9 23146903 Puppet and OpenStack modules need modification notices
Patrick Einheber <patrick.einheber@oracle.com>
parents: 2068
diff changeset
    14
@@ -156,3 +160,29 @@
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
 end
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    17
 end
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    18
+
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    19
+Facter.add("kernel_zone") do
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    20
+  confine :operatingsystem => :Solaris
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    21
+  setcode do
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    22
+      virtinfo = %x{/sbin/virtinfo list -H -o class kernel-zone 2>/dev/null}
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    23
+      case virtinfo.chomp!
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    24
+      when "supported", "current", "parent"
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    25
+          virtinfo
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    26
+      else
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    27
+          "unsupported"
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
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    30
+end
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    31
+
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    32
+Facter.add("non_global_zone") do
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    33
+  confine :operatingsystem => :Solaris
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    34
+  setcode do
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    35
+      virtinfo = %x{/sbin/virtinfo list -H -o class non-global-zone 2>/dev/null}
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    36
+      case virtinfo.chomp!
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    37
+      when "supported", "current"
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    38
+          virtinfo
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    39
+      else
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    40
+          "unsupported"
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    41
+      end
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    42
+  end
4e371f01e40f 18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff changeset
    43
+end