components/ruby/facter/patches/facter-05-FACT-662.patch
author Kristina Tripp <Kristina.Tripp@oracle.com>
Fri, 17 Oct 2014 09:32:29 -0700
branchs11-update
changeset 3401 bd976a0fa74e
child 5860 afd31ba91ee9
permissions -rw-r--r--
18354422 facter cannot parse the output of GNU uptime 18960283 problem in UTILITY/PUPPET 18960296 Update Facter to 2.1.0 19357281 facter --help doesn't work 19402424 puppet error when no swap devices configured 19646677 facter-19 package not installed if ruby-19 not installed 19596952 Update facter 2.1.0 license 17797881 Add facter support for ldoms
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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