author | Kristina Tripp <Kristina.Tripp@oracle.com> |
Fri, 17 Oct 2014 09:32:29 -0700 | |
branch | s11-update |
changeset 3401 | bd976a0fa74e |
child 5860 | afd31ba91ee9 |
permissions | -rw-r--r-- |
3401
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
1 |
Patch for FACT-662 Extend ldom.rb to indicate whether ldom creation is supported |
bd976a0fa74e
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-662 |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
3 |
--- facter-2.1.0/lib/facter/ldom.rb.orig 2014-08-20 10:20:46.279840866 -0600 |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
4 |
+++ facter-2.1.0/lib/facter/ldom.rb 2014-08-20 10:25:26.560542193 -0600 |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
5 |
@@ -46,4 +46,37 @@ |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
6 |
end |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
7 |
end |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
8 |
end |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
9 |
+ |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
10 |
+ |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
11 |
+ # |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
12 |
+ # Resolution: Provides the following logical_domain information. |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
13 |
+ # current: The current environment is logical domain. |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
14 |
+ # supported: The current environment is control domain which can have logical |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
15 |
+ # domain |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
16 |
+ # unsupported: Logical domain is not supported on the environment |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
17 |
+ # |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
18 |
+ Facter.add("logical_domain") do |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
19 |
+ setcode do |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
20 |
+ virtinfo = %x{/sbin/virtinfo list -H -o class logical-domain 2>/dev/null} |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
21 |
+ virtinfo = virtinfo.split("\n") |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
22 |
+ virtinfo = virtinfo[0] # Doesn't need to check each logical-domain class |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
23 |
+ |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
24 |
+ case virtinfo |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
25 |
+ when "supported" |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
26 |
+ virtinfo |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
27 |
+ when "current" |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
28 |
+ # Even control domain can have "logical_domain => current" |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
29 |
+ # To verify, control-role property should be examined. |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
30 |
+ ctrl_role = %x{virtinfo -c current get -Ho value control-role logical-domain 2> /dev/null} |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
31 |
+ case ctrl_role.chomp! |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
32 |
+ when "true" |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
33 |
+ "supported" |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
34 |
+ when "false" |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
35 |
+ virtinfo |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
36 |
+ end |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
37 |
+ else |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
38 |
+ "unsupported" |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
39 |
+ end |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
40 |
+ end |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
41 |
+ end |
bd976a0fa74e
18354422 facter cannot parse the output of GNU uptime
Kristina Tripp <Kristina.Tripp@oracle.com>
parents:
diff
changeset
|
42 |
end |