1 Add output for kernel zones and fix prtdiag output so that it doesn't report |
|
2 an error in a kernel zone. |
|
3 --- facter-1.6.16/lib/facter/virtual.rb.orig 2013-06-10 15:19:45.461022623 -0600 |
|
4 +++ facter-1.6.16/lib/facter/virtual.rb 2013-06-10 15:22:54.164653119 -0600 |
|
5 @@ -119,9 +119,9 @@ |
|
6 result = "hyperv" if pd =~ /Product Name: Virtual Machine/ |
|
7 end |
|
8 elsif Facter.value(:kernel) == 'SunOS' |
|
9 - res = Facter::Util::Resolution.new('prtdiag') |
|
10 + res = Facter::Util::Resolution.new('/usr/sbin/prtdiag 2>/dev/null') |
|
11 res.timeout = 6 |
|
12 - res.setcode('prtdiag') |
|
13 + res.setcode('/usr/sbin/prtdiag 2>/dev/null') |
|
14 output = res.value |
|
15 if not output.nil? |
|
16 output.each_line do |pd| |
|
17 @@ -210,3 +210,52 @@ |
|
18 end |
|
19 end |
|
20 end |
|
21 + |
|
22 +# |
|
23 +# Fact: kernel_zone |
|
24 +# |
|
25 +# Purpose: A facter fact to report kernel zones status on a system. |
|
26 +# |
|
27 +# Resolution: Provides the following kernel zone information. |
|
28 +# supported: kernel zones are supported |
|
29 +# unsupported: kernel zones are not supported |
|
30 +# current: the current environment is a kernel zone |
|
31 +# parent: the current environment is a child of a kernel zone |
|
32 +# |
|
33 +Facter.add("kernel_zone") do |
|
34 + confine :operatingsystem => :Solaris |
|
35 + setcode do |
|
36 + virtinfo = %x{/sbin/virtinfo list -H -o class kernel-zone 2>/dev/null} |
|
37 + case virtinfo.chomp! |
|
38 + when "supported" |
|
39 + when "current" |
|
40 + when "parent" |
|
41 + virtinfo |
|
42 + else |
|
43 + "unsupported" |
|
44 + end |
|
45 + end |
|
46 +end |
|
47 + |
|
48 +# |
|
49 +# Fact: non_global_zone |
|
50 +# |
|
51 +# Purpose: A facter fact to report non-global zone status on a system. |
|
52 +# |
|
53 +# Resolution: Provides the following kernel zone information. |
|
54 +# current: the current environment is a non-global zone |
|
55 +# Otherwise returns supported because non-global zones are supported |
|
56 +# in Solaris in both global and kernel zones. |
|
57 +# |
|
58 +Facter.add("non_global_zone") do |
|
59 + confine :operatingsystem => :Solaris |
|
60 + setcode do |
|
61 + virtinfo = %x{/sbin/virtinfo list -H -o class non-global-zone 2>/dev/null} |
|
62 + case virtinfo.chomp! |
|
63 + when "current" |
|
64 + virtinfo |
|
65 + else |
|
66 + "supported" |
|
67 + end |
|
68 + end |
|
69 +end |
|