25463219 puppet modules need to declare a minimum puppet version dependency
authorShawn Ferry <shawn.ferry@oracle.com>
Fri, 03 Feb 2017 12:49:15 -0800
changeset 7651 70c0daa6928d
parent 7650 2e39c59b83f8
child 7652 8ea2de474b66
25463219 puppet modules need to declare a minimum puppet version dependency 25471549 Puppet 4: package resource "ensure => latest" results in stack trace 25476627 hiera lists an obsolete dependency on json_pure 25497490 revert 21815619 (puppet does not install latest pkg) and rework solution 25506345 puppet cli commands spam messages about SMF services
components/ruby/hiera/patches/hiera-00-json.patch
components/ruby/puppet-modules/nanliu-staging/nanliu-staging.p5m
components/ruby/puppet-modules/oracle-solaris_providers/oracle-solaris_providers.p5m
components/ruby/puppet-modules/puppetlabs-apache/puppetlabs-apache.p5m
components/ruby/puppet-modules/puppetlabs-concat/puppetlabs-concat.p5m
components/ruby/puppet-modules/puppetlabs-inifile/puppetlabs-inifile.p5m
components/ruby/puppet-modules/puppetlabs-mysql/puppetlabs-mysql.p5m
components/ruby/puppet-modules/puppetlabs-ntp/puppetlabs-ntp.p5m
components/ruby/puppet-modules/puppetlabs-rabbitmq/puppetlabs-rabbitmq.p5m
components/ruby/puppet-modules/puppetlabs-rsync/puppetlabs-rsync.p5m
components/ruby/puppet-modules/puppetlabs-stdlib/puppetlabs-stdlib.p5m
components/ruby/puppet-modules/saz-memcached/saz-memcached.p5m
components/ruby/puppet/patches/puppet-12-pkg-provider-latest.patch
components/ruby/puppet/patches/puppet-14-log-smf.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ruby/hiera/patches/hiera-00-json.patch	Fri Feb 03 12:49:15 2017 -0800
@@ -0,0 +1,22 @@
+Patch mirrors upstream 3.2.1 removes json dependency required for ruby 1.8.7
+
+--- b/hiera.gemspec	2017-01-31 12:08:33.457351799 +0000
++++ hiera.gemspec	2017-01-31 12:10:58.865568567 +0000
[email protected]@ -17,17 +17,5 @@
+   s.rubygems_version = "2.2.3"
+   s.summary = "Light weight hierarchical data store"
+   s.test_files = ["spec/unit/interpolate_spec.rb", "spec/unit/fixtures/override/config/hiera.yaml", "spec/unit/fixtures/override/data/alternate.yaml", "spec/unit/fixtures/override/data/common.yaml", "spec/unit/fixtures/interpolate/config/hiera_iplm_hiera.yaml", "spec/unit/fixtures/interpolate/config/hiera_iplm_hiera_bad.yaml", "spec/unit/fixtures/interpolate/config/hiera.yaml", "spec/unit/fixtures/interpolate/data/niltest.yaml", "spec/unit/fixtures/interpolate/data/complex.yaml", "spec/unit/fixtures/interpolate/data/frontend.json", "spec/unit/fixtures/interpolate/data/role.json", "spec/unit/fixtures/interpolate/data/bad_interpolation.yaml", "spec/unit/fixtures/interpolate/data/dotted_keys.yaml", "spec/unit/fixtures/interpolate/data/weird_keys.yaml", "spec/unit/fixtures/interpolate/data/empty_interpolation.yaml", "spec/unit/fixtures/interpolate/data/recursive.yaml", "spec/unit/backend_spec.rb", "spec/unit/filecache_spec.rb", "spec/unit/config_spec.rb", "spec/unit/backend/yaml_backend_spec.rb", "spec/unit/backend/json_backend_spec.rb", "spec/unit/puppet_logger_spec.rb", "spec/unit/console_logger_spec.rb", "spec/unit/version_spec.rb", "spec/unit/fallback_logger_spec.rb", "spec/unit/util_spec.rb", "spec/unit/hiera_spec.rb", "spec/spec_helper.rb"]
+-
+-  if s.respond_to? :specification_version then
+-    s.specification_version = 3
+-
+-    if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+-      s.add_runtime_dependency(%q<json_pure>, [">= 0"])
+-    else
+-      s.add_dependency(%q<json_pure>, [">= 0"])
+-    end
+-  else
+-    s.add_dependency(%q<json_pure>, [">= 0"])
+-  end
+ end
+ 
--- a/components/ruby/puppet-modules/nanliu-staging/nanliu-staging.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/nanliu-staging/nanliu-staging.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -81,4 +81,5 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/oracle-solaris_providers/oracle-solaris_providers.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/oracle-solaris_providers/oracle-solaris_providers.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -238,5 +238,5 @@
 file path=solaris_providers/spec/unit/type/zone_spec.rb
 license apache.license license="Apache v2.0"
 
-# require puppet
-depend type=require fmri=system/management/puppet
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/puppetlabs-apache/puppetlabs-apache.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/puppetlabs-apache/puppetlabs-apache.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -355,10 +355,11 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
 
 # force a dependency on puppetlabs-concat
 depend type=require fmri=system/management/puppet/puppetlabs-concat
 
 # force a dependency on puppetlabs-stdlib
 depend type=require fmri=system/management/puppet/puppetlabs-stdlib
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/puppetlabs-concat/puppetlabs-concat.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/puppetlabs-concat/puppetlabs-concat.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -98,4 +98,5 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/puppetlabs-inifile/puppetlabs-inifile.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/puppetlabs-inifile/puppetlabs-inifile.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -97,4 +97,5 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/puppetlabs-mysql/puppetlabs-mysql.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/puppetlabs-mysql/puppetlabs-mysql.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -155,10 +155,11 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
 
 # force a dependency on nanliu-staging
 depend type=require fmri=system/management/puppet/nanliu-staging
 
 # force a dependency on puppetlabs-stdlib
 depend type=require fmri=system/management/puppet/puppetlabs-stdlib
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/puppetlabs-ntp/puppetlabs-ntp.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/puppetlabs-ntp/puppetlabs-ntp.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -89,7 +89,8 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
 
 # force a dependency on puppetlabs-stdlib
 depend type=require fmri=system/management/puppet/puppetlabs-stdlib
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/puppetlabs-rabbitmq/puppetlabs-rabbitmq.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/puppetlabs-rabbitmq/puppetlabs-rabbitmq.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -144,7 +144,8 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
 
 # force a dependency on puppetlabs-stdlib
 depend type=require fmri=system/management/puppet/puppetlabs-stdlib
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/puppetlabs-rsync/puppetlabs-rsync.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/puppetlabs-rsync/puppetlabs-rsync.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -71,10 +71,11 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
 
 # force a dependency on puppetlabs-concat
 depend type=require fmri=system/management/puppet/puppetlabs-concat
 
 # force a dependency on puppetlabs-stdlib
 depend type=require fmri=system/management/puppet/puppetlabs-stdlib
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/puppetlabs-stdlib/puppetlabs-stdlib.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/puppetlabs-stdlib/puppetlabs-stdlib.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -441,4 +441,5 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet-modules/saz-memcached/saz-memcached.p5m	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet-modules/saz-memcached/saz-memcached.p5m	Fri Feb 03 12:49:15 2017 -0800
@@ -62,7 +62,8 @@
 # Renamed Package
 depend type=optional \
     fmri=system/management/puppet/[email protected]
-depend type=require fmri=system/management/puppet
 
 # force a dependency on puppetlabs-stdlib
 depend type=require fmri=system/management/puppet/puppetlabs-stdlib
+# Require Puppet 4.x for module path changes
+depend type=require fmri=system/management/[email protected]
--- a/components/ruby/puppet/patches/puppet-12-pkg-provider-latest.patch	Tue Feb 07 09:08:08 2017 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-In-house patch to fix Solaris specific bug; not suitible for upstream
-Fixing issue with package ensure=>latest by refreshing the pkg cache first with pkg update
-Using --parsable=0 option to obsolete pkg list -Hn
-Fixing problem with ambiguous package names
-Wildcards support
-install_options/uninstall_options features support
-
-diff --git a/lib/puppet/provider/package/pkg.rb b/lib/puppet/provider/package/pkg.rb
---- a/lib/puppet/provider/package/pkg.rb
-+++ b/lib/puppet/provider/package/pkg.rb
[email protected]@ -1,7 +1,7 @@
- require 'puppet/provider/package'
- 
- Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package do
--  desc "OpenSolaris image packaging system. See pkg(5) for more information."
-+  desc "Solaris image packaging system. See pkg(5) for more information"
-   # https://docs.oracle.com/cd/E19963-01/html/820-6572/managepkgs.html
-   # A few notes before we start:
-   # Opensolaris pkg has two slightly different formats (as of now.)
[email protected]@ -14,10 +14,10 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
-   # TODO: We still have to allow packages to specify a preferred publisher.
- 
-   has_feature :versionable
--
-   has_feature :upgradable
--
-   has_feature :holdable
-+  has_feature :install_options
-+  has_feature :uninstall_options
- 
-   commands :pkg => "/usr/bin/pkg"
- 
[email protected]@ -69,6 +69,10 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
-     {}
-   end
- 
-+  def self.ufxi_flag(flags)
-+    {}
-+  end
-+
-   # pkg state was present in the older version of pkg (with UFOXI) but is
-   # no longer available with the IFO field version. When it was present,
-   # it was used to indicate that a particular version was present (installed)
[email protected]@ -100,11 +104,74 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
-     when %r'^pkg://([^/]+)/([^@]+)@(\S+) +(\S+) +(.....)$'
-       {:publisher => $1, :name => $2, :ensure => $3}.merge pkg_state($4).merge(ufoxi_flag($5))
- 
-+    #pkg list -vH output format since build 165
-+    #FMRI                                                                         IFO
-+    #pkg://solaris/system/[email protected]:20151116T010109Z           i--
-+    when /^(\S+) +(...)$/
-+      full_fmri = $1.split('@')
-+      {:name => full_fmri[0], :ensure => full_fmri[1]}.merge(ifo_flag($2))
-+
-+    #Solaris11 Express 10/11, OpenSolaris
-+    #FMRI                                                               STATE       UFOXI
-+    #pkg://solaris/editor/[email protected],5.11-0.151.0.1:20101105T0540492   installed   -----
-+    when /^(\S+) +(\S+) +(.....)$/
-+      full_fmri = $1.split('@')
-+      {:name => full_fmri[0], :ensure => full_fmri[1]}.merge pkg_state($2).merge(ufoxi_flag($3))
-+
-+    #OpenSolaris
-+    #FMRI                                               STATE       UFXI
-+    #pkg:/[email protected],5.11-0.86:20080426T180612Z    installed   ----
-+    when /^(\S+) +(\S+) +(....)$/
-+      full_fmri = $1.split('@')
-+      {:name => full_fmri[0], :ensure => full_fmri[1]}.merge pkg_state($2).merge(ufxi_flag($3))
-+
-     else
-       raise ArgumentError, 'Unknown line format %s: %s' % [self.name, line]
-     end).merge({:provider => self.name})
-   end
- 
-+  def parse_latest_query(exit_code, pkg_fmri_list)
-+    # Get the current status of the package
-+    name = @property_hash[:name]
-+    provider = @property_hash[:provider]
-+
-+    # The package is up-to-date
-+    if pkg_fmri_list.empty? && exit_code == 4
-+      status = 'installed'
-+      version = @property_hash[:ensure]
-+    # Latest version is available
-+    elsif !pkg_fmri_list.empty? && exit_code == 0
-+      if wildcard?
-+        version = ''
-+        status = 'known'
-+      else
-+        # Search for the correct pkg FMRI (to ignore dependencies)
-+        # search string format will be, i.e.,
-+        # pkg://test/testing/[email protected]
-+        # and retrieve the matched index.
-+        search_pkg_name = name + '@'
-+        index = pkg_fmri_list.index{|l| l[0].include?(search_pkg_name)}
-+        raise Puppet::Error, "Cannot retrieve pkg name" if index.nil?
-+
-+        # Parse the fmri of the latest available pkg, i.e.,
-+        # from: pkg://test/testing/[email protected],5.11:20151112T015434Z
-+        # to: 1.0.13,5.11:20151112T015434Z
-+        version = pkg_fmri_list[index][1].split('@')[1]
-+        status = 'known'
-+      end
-+    else
-+      raise Puppet::Error, "Cannot retrieve pkg version"
-+    end
-+
-+    # Store as a desirable query
-+    return {
-+      :name=>name,
-+      :ensure=>version,
-+      :status=>status,
-+      :provider=>provider
-+    }
-+  end
-+
-   def hold
-     pkg(:freeze, @resource[:name])
-   end
[email protected]@ -167,28 +234,28 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
-     false
-   end
- 
--  # Return the version of the package. Note that the bug
--  # http://defect.opensolaris.org/bz/show_bug.cgi?id=19159%
--  # notes that we can't use -Ha for the same even though the manual page reads that way.
-   def latest
--    lines = pkg(:list, "-Hvn", @resource[:name]).split("\n")
-+    # Dry-run package update to check the availability of the latest version
-+    # -- return code --
-+    # 0: latest version available
-+    # 1: error
-+    # 4: already up-to-date
-+    r = exec_cmd(command(:pkg), 'update', '-n', '--parsable=0', @resource[:name]).split('\n')
-+    package_versions = JSON.parse(r[:out])['change-packages']
- 
-     # remove certificate expiration warnings from the output, but report them
--    cert_warnings = lines.select { |line| line =~ /^Certificate/ }
-+    cert_warnings = r[:out].select { |line| line =~ /^Certificate/ }
-     unless cert_warnings.empty?
-       Puppet.warning("pkg warning: #{cert_warnings.join(', ')}")
-     end
-+    lst = r[:out].select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }
- 
--    lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }
--
--    # Now we know there is a newer version. But is that installable? (i.e are there any constraints?)
--    # return the first known we find. The only way that is currently available is to do a dry run of
--    # pkg update and see if could get installed (`pkg update -n res`).
--    known = lst.find {|p| p[:status] == 'known' }
--    return known[:ensure] if known and exec_cmd(command(:pkg), 'update', '-n', @resource[:name])[:exit].zero?
-+    raise Puppet::Error, "Cannot update to the latest package: #{r[:out]}\n" \
-+      unless [0, 4].include? r[:exit]
- 
--    # If not, then return the installed, else nil
--    (lst.find {|p| p[:status] == 'installed' } || {})[:ensure]
-+    lst =  parse_latest_query(r[:exit], package_versions)
-+    Puppet.debug "Desirable query status = #{lst}"
-+    return lst[:ensure]
-   end
- 
-   # install the package and accept all licenses.
[email protected]@ -206,7 +273,10 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
-     unless should.is_a? Symbol
-       name += "@#{should}"
-     end
--    r = exec_cmd(command(:pkg), command, '--accept', name)
-+
-+    opts = ['--accept']
-+    opts << join_options(@resource[:install_options]) if @resource[:install_options]
-+    r = exec_cmd(command(:pkg), 'install', opts, name)
-     return r if nofail
-     raise Puppet::Error, "Unable to update #{r[:out]}" if r[:exit] != 0
-   end
[email protected]@ -219,6 +289,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
-     when /052adf36c3f4/
-       cmd << '-r'
-     end
-+    cmd << join_options(@resource[:uninstall_options]) if @resource[:uninstall_options]
-     cmd << @resource[:name]
-     pkg cmd
-   end
[email protected]@ -231,10 +302,22 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
-     raise Puppet::Error, "Unable to update #{r[:out]}"
-   end
- 
-+  def wildcard?
-+    @resource[:name].include?("*") || @resource[:name].include?("?")
-+  end
-+
-   # list a specific package
-   def query
-     r = exec_cmd(command(:pkg), 'list', '-Hv', @resource[:name])
-     return {:ensure => :absent, :name => @resource[:name]} if r[:exit] != 0
-+
-+    # Does input contain wildcard? just pass it down and let pkg decide
-+    return {:ensure => :installed, :name => @resource[:name], :provider => self.class.name} if wildcard?
-+    # If there are more than one results? this will fail due to the ambiguity.
-+    if r[:out].split("\n").length > 1
-+      raise Puppet::Error, "'#{@resource[:name]}' matches multiple packages. \n#{r[:out]}"
-+    end
-+    # Pass the parsed result back to @property_hash
-     self.class.parse_line(r[:out])
-   end
- 
--- a/components/ruby/puppet/patches/puppet-14-log-smf.patch	Tue Feb 07 09:08:08 2017 -0800
+++ b/components/ruby/puppet/patches/puppet-14-log-smf.patch	Fri Feb 03 12:49:15 2017 -0800
@@ -20,9 +20,9 @@
 +    if Puppet[:degrade_smf_on_error]
 +      if [email protected]
 +        if Puppet.run_mode.agent?
-+          system 'svcadm clear puppet:agent'
++          system 'svcadm clear puppet:agent > /dev/null 2>&1'
 +        elsif Puppet.run_mode.master?
-+          system 'svcadm clear puppet:master'
++          system 'svcadm clear puppet:master > /dev/null 2>&1'
 +        end
 +      end
 +    end