--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/facter/patches/facter-02-ldoms-prtdiag.patch Tue Feb 11 16:49:58 2014 -0800
@@ -0,0 +1,59 @@
+Add LDOMS facter for SPARC and fix prtdiag output so that it doesn't report
+--- facter-1.6.18/lib/facter/virtual.rb.orig 2014-02-04 14:06:17.961499519 -0800
++++ facter-1.6.18/lib/facter/virtual.rb 2014-02-04 14:15:22.888059597 -0800
[email protected]@ -119,9 +119,9 @@
+ result = "hyperv" if pd =~ /Product Name: Virtual Machine/
+ end
+ elsif Facter.value(:kernel) == 'SunOS'
+- res = Facter::Util::Resolution.new('prtdiag')
++ res = Facter::Util::Resolution.new('/usr/sbin/prtdiag 2>/dev/null')
+ res.timeout = 6
+- res.setcode('prtdiag')
++ res.setcode('/usr/sbin/prtdiag 2>/dev/null')
+ output = res.value
+ if not output.nil?
+ output.each_line do |pd|
[email protected]@ -210,3 +210,43 @@
+ end
+ end
+ end
++
++
++##
++# Fact: logical_domain
++#
++# Purpose: A facter fact to report logical_domain(ldom) status on a system.
++# This facter is only available on SPARC
++#
++# Resolution: Provides the following logical_domain information.
++# current: The current environment is ldogical domain.
++# supported: The current environment is control domain which can have logical
++# domain
++# unsupported: Logical domain is not supported on the environment
++#
++
++Facter.add("logical_domain") do
++ confine :operatingsystem => :Solaris, :hardwareisa => :sparc
++ setcode do
++ virtinfo = %x{/sbin/virtinfo list -H -o class logical-domain 2>/dev/null}
++ virtinfo = virtinfo.split("\n")
++ virtinfo = virtinfo[0] # Doesn't need to check each logical-domain class
++
++ case virtinfo
++ when "supported"
++ virtinfo
++ when "current"
++ # Even control domain can have "logical_domain => current"
++ # To verify, control-role property should be examined.
++ ctrl_role = %x{virtinfo -c current get -Ho value control-role logical-domain 2> /dev/null}
++ case ctrl_role.chomp!
++ when "true"
++ "supported"
++ when "false"
++ virtinfo
++ end
++ else
++ "unsupported"
++ end
++ end
++end
--- a/components/facter/patches/facter-02-virtual-zones-facts.patch Wed Feb 05 04:10:56 2014 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-Add output for kernel zones and fix prtdiag output so that it doesn't report
-an error in a kernel zone.
---- facter-1.6.16/lib/facter/virtual.rb.orig 2013-06-10 15:19:45.461022623 -0600
-+++ facter-1.6.16/lib/facter/virtual.rb 2013-06-10 15:22:54.164653119 -0600
[email protected]@ -119,9 +119,9 @@
- result = "hyperv" if pd =~ /Product Name: Virtual Machine/
- end
- elsif Facter.value(:kernel) == 'SunOS'
-- res = Facter::Util::Resolution.new('prtdiag')
-+ res = Facter::Util::Resolution.new('/usr/sbin/prtdiag 2>/dev/null')
- res.timeout = 6
-- res.setcode('prtdiag')
-+ res.setcode('/usr/sbin/prtdiag 2>/dev/null')
- output = res.value
- if not output.nil?
- output.each_line do |pd|
[email protected]@ -210,3 +210,52 @@
- end
- end
- end
-+
-+#
-+# Fact: kernel_zone
-+#
-+# Purpose: A facter fact to report kernel zones status on a system.
-+#
-+# Resolution: Provides the following kernel zone information.
-+# supported: kernel zones are supported
-+# unsupported: kernel zones are not supported
-+# current: the current environment is a kernel zone
-+# parent: the current environment is a child of a kernel zone
-+#
-+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"
-+ when "current"
-+ when "parent"
-+ virtinfo
-+ else
-+ "unsupported"
-+ end
-+ end
-+end
-+
-+#
-+# Fact: non_global_zone
-+#
-+# Purpose: A facter fact to report non-global zone status on a system.
-+#
-+# Resolution: Provides the following kernel zone information.
-+# current: the current environment is a non-global zone
-+# Otherwise returns supported because non-global zones are supported
-+# in Solaris in both global and kernel zones.
-+#
-+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 "current"
-+ virtinfo
-+ else
-+ "supported"
-+ end
-+ end
-+end