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

Patch for FACT-660 Facter on Solaris 11.2+ should report if zones are supported
Upstream bug: https://tickets.puppetlabs.com/browse/FACT-660

--- facter-2.4.6/lib/facter/util/solaris_zones.rb.orig	2016-04-19 15:21:42.808586315 -0700
+++ facter-2.4.6/lib/facter/util/solaris_zones.rb	2016-04-19 15:22:05.762477352 -0700
@@ -1,3 +1,7 @@
+#######################################################################
+# Oracle has modified the originally distributed contents of this file.
+#######################################################################
+
 require 'facter/util/resolution'
 
 module Facter
@@ -156,3 +160,29 @@
   end
 end
 end
+
+Facter.add("kernel_zone") do
+  confine :operatingsystem => :Solaris
+  setcode do
+      virtinfo = %x{/sbin/virtinfo list -H -o class kernel-zone 2>/dev/null}
+      case virtinfo.chomp!
+      when "supported", "current", "parent"
+          virtinfo
+      else
+          "unsupported"
+      end
+  end
+end
+
+Facter.add("non_global_zone") do
+  confine :operatingsystem => :Solaris
+  setcode do
+      virtinfo = %x{/sbin/virtinfo list -H -o class non-global-zone 2>/dev/null}
+      case virtinfo.chomp!
+      when "supported", "current"
+          virtinfo
+      else
+          "unsupported"
+      end
+  end
+end