18631785 puppet command should be part of Puppet Management profile
authorPatrick Einheber <patrick.einheber@oracle.com>
Thu, 22 Oct 2015 07:49:29 -0700
changeset 4995 ecffc6614cfa
parent 4994 ed928e1888f8
child 4997 714545171c17
18631785 puppet command should be part of Puppet Management profile 21925076 ldap provider incorrectly handles list properties 21936192 facter should use ifconfig, getent or host if available to get ip address
components/ruby/facter/patches/facter-06-21936192-ipaddress.patch
components/ruby/puppet/files/exec_attr
components/ruby/puppet/files/solaris/lib/puppet/type/ldap.rb
components/ruby/puppet/puppet-GENFRAG.p5m
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ruby/facter/patches/facter-06-21936192-ipaddress.patch	Thu Oct 22 07:49:29 2015 -0700
@@ -0,0 +1,68 @@
+Split from BSD method and add getent hosts
+Also don't try to run `host hostname` if the host command isn't available.
+No upstream facter 2.x is dead and new bugs are not being accepted.
+--- facter-2.1.0/lib/facter/ipaddress.rb.orig	2015-10-02 13:17:19.199030743 -0400
++++ facter-2.1.0/lib/facter/ipaddress.rb	2015-10-02 13:17:25.713426750 -0400
+@@ -64,7 +64,7 @@
+ end
+ 
+ Facter.add(:ipaddress) do
+-  confine :kernel => %w{NetBSD SunOS}
++  confine :kernel => %w{NetBSD}
+   setcode do
+     ip = nil
+     output = Facter::Util::IP.exec_ifconfig(["-a"])
+@@ -84,6 +84,41 @@
+ end
+ 
+ Facter.add(:ipaddress) do
++  confine :osfamily => %w{Solaris}
++  setcode do
++    ip = nil
++    output = Facter::Util::IP.exec_ifconfig(["-a"])
++
++    output.each_line { |str|
++      if str =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/
++        tmp = $1
++        unless tmp =~ /^127\./ or tmp == "0.0.0.0"
++          ip = tmp
++          break
++        end
++      end
++    }
++
++    # If we didn't get an IP from ifconfig see if we can get one from
++    # the hosts database
++    if ip.nil? && hostname = Facter.value(:hostname)
++      # we need Hostname to exist for this to work
++      host = nil
++      Facter::Core::Execution.execute("getent hosts #{hostname}").each_line {
++        |l|
++        _ip = l.chomp.split()[0]
++        if _ip !~ /^127\./ && _ip =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/
++          ip = _ip
++          break
++        end
++      }
++    end
++
++    ip
++  end
++end
++
++Facter.add(:ipaddress) do
+   confine :kernel => %w{AIX}
+   setcode do
+     ip = nil
+@@ -152,8 +187,9 @@
+ 
+ Facter.add(:ipaddress, :timeout => 2) do
+   setcode do
+-    if hostname = Facter.value(:hostname)
+-      # we need Hostname to exist for this to work
++    if hostname = Facter.value(:hostname) &&
++      Facter::Core::Execution.which('host')
++      # we need Hostname and `host` to exist for this to work
+       host = nil
+       if host = Facter::Core::Execution.execute("host #{hostname}")
+         list = host.chomp.split(/\s/)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ruby/puppet/files/exec_attr	Thu Oct 22 07:49:29 2015 -0700
@@ -0,0 +1,1 @@
+Puppet Management:solaris:cmd:RO::/usr/sbin/puppet:uid=0
--- a/components/ruby/puppet/files/solaris/lib/puppet/type/ldap.rb	Thu Oct 22 04:16:09 2015 -0700
+++ b/components/ruby/puppet/files/solaris/lib/puppet/type/ldap.rb	Thu Oct 22 07:49:29 2015 -0700
@@ -81,9 +81,18 @@
             is.sort == self.should.sort
         end
 
-        # svcprop returns multivalue entries delimited with a space
+        # svcprop returns multivalue entries delimited with a spaces/backslashes
         def delimiter
-            " "
+            /[\s\\]+/
+        end
+
+        # create a list using spaces as a delimiter
+        def is_to_s(currentvalue)
+            if currentvalue == :absent
+                return "absent"
+            else
+                return currentvalue.join(" ")
+            end
         end
 
         validate do |value|
@@ -110,9 +119,18 @@
             is.sort == self.should.sort
         end
 
-        # svcprop returns multivalue entries delimited with a space
+        # svcprop returns multivalue entries delimited with a spaces/backslashes
         def delimiter
-            " "
+            /[\s\\]+/
+        end
+
+        # create a list using spaces as a delimiter
+        def is_to_s(currentvalue)
+            if currentvalue == :absent
+                return "absent"
+            else
+                return currentvalue.join(" ")
+            end
         end
 
         validate do |value|
--- a/components/ruby/puppet/puppet-GENFRAG.p5m	Thu Oct 22 04:16:09 2015 -0700
+++ b/components/ruby/puppet/puppet-GENFRAG.p5m	Thu Oct 22 07:49:29 2015 -0700
@@ -169,6 +169,7 @@
 file files/solaris/lib/puppet/type/vnic.rb \
     path=etc/puppet/modules/solaris/lib/puppet/type/vnic.rb mode=0555
 file files/auth_attr path=etc/security/auth_attr.d/puppet
+file files/exec_attr path=etc/security/exec_attr.d/puppet
 file files/prof_attr path=etc/security/prof_attr.d/puppet
 file files/user_attr path=etc/user_attr.d/puppet
 file files/puppet.xml path=lib/svc/manifest/application/puppet.xml