Package: puppet
Version: 4.10.4-2
Severity: important

Dear Maintainer,

With the following code in site.pp or similar:

  filebucket { 'main':
    path => false, # Remote filebucket
  }
  File {
    backup => 'main',
  }

Bucketing fails from puppet3 agent to puppet master 4 (stretch/sid) with:
  Error: Could not back up /etc/puppet/auth.conf: Error 406 on SERVER:
{"message":"Not Acceptable: No supported formats are acceptable
(Accept: s, pson)","issue_kind":"UNSUPPORTED_FORMAT"}

The attached patch fixes this and matches the behavior of:
https://github.com/puppetlabs/puppetserver/blob/ff0e5e84860ea9b035839e77e9b27d4c3a923e36/src/clj/puppetlabs/services/legacy_routes/legacy_routes_core.clj#L27-L42

NB: I think this should also go in stretch-pu.

Regards

Mathieu Parent
From eb03e3dcaad385660bf95d692c9bd5acbb8996ea Mon Sep 17 00:00:00 2001
From: Mathieu Parent <mathieu.par...@nantesmetropole.fr>
Date: Fri, 21 Jul 2017 12:16:28 +0200
Subject: [PATCH] Fix "No supported formats are acceptable (Accept: s, pson)"
 while bucketing from Puppet Agent v3

---
 debian/patches/0001-Adjust-default-paths.patch     |  4 +-
 .../0004-add-puppet3-compat-middleware.patch       | 10 ++---
 ...e-systemd-as-the-default-service-provider.patch | 19 ++++----
 .../0006-debian-service-provider-use-service.patch | 18 +++++---
 ...vice-listing-and-enable-disable-in-Debian.patch | 52 +++++++++++-----------
 debian/patches/0008-fix-locale-loading.patch       | 16 ++++---
 6 files changed, 67 insertions(+), 52 deletions(-)

diff --git a/debian/patches/0001-Adjust-default-paths.patch b/debian/patches/0001-Adjust-default-paths.patch
index 1bc3df858..de7b33ea8 100644
--- a/debian/patches/0001-Adjust-default-paths.patch
+++ b/debian/patches/0001-Adjust-default-paths.patch
@@ -8,10 +8,10 @@ Subject: Adjust default paths
  2 files changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
-index f63a08a..f76ce1e 100644
+index 8669913..d41d9be 100644
 --- a/lib/puppet/defaults.rb
 +++ b/lib/puppet/defaults.rb
-@@ -1206,7 +1206,7 @@ EOT
+@@ -1250,7 +1250,7 @@ EOT
        :desc       => "File that provides mapping between custom SSL oids and user-friendly names"
      },
      :basemodulepath => {
diff --git a/debian/patches/0004-add-puppet3-compat-middleware.patch b/debian/patches/0004-add-puppet3-compat-middleware.patch
index 04b6f3f53..33117629e 100644
--- a/debian/patches/0004-add-puppet3-compat-middleware.patch
+++ b/debian/patches/0004-add-puppet3-compat-middleware.patch
@@ -4,10 +4,11 @@ Description: Add Puppet 3 client compatibility under rack
  per[1]. This should restore compatibility with Puppet 3 clients when
  run under any rack-enabled server (including Passenger).
 Forwarded: no (deprecated upstream)
-Last-Update: 2017-01-11
+Last-Update: 2017-07-21
+
 --- a/ext/rack/config.ru
 +++ b/ext/rack/config.ru
-@@ -25,6 +25,74 @@
+@@ -25,6 +25,73 @@
  # delivered during catalog compilation.
  ARGV << "--always_cache_features"
  
@@ -62,9 +63,8 @@ Last-Update: 2017-01-11
 +      env['QUERY_STRING'] = Rack::Utils.build_query(@req.params)
 +    end
 +
-+    if @api =~ /^file_(content|bucket_file)/ && @req.get?
-+      env["HTTP_ACCEPT"] = "binary"
-+    elsif @api == "file_bucket_file" && (@req.post? || @req.put?)
++    env["HTTP_ACCEPT"] = env["HTTP_ACCEPT"].split(/\s*,\s*/).map { |a| a.sub(/^raw|s$/, 'binary') }.join(', ')
++    if @api == "file_bucket_file" && (@req.post? || @req.put?)
 +      env["CONTENT_TYPE"] = "application/octet-stream"
 +    end
 +
diff --git a/debian/patches/0005-use-systemd-as-the-default-service-provider.patch b/debian/patches/0005-use-systemd-as-the-default-service-provider.patch
index 2871e72ae..d4bc82698 100644
--- a/debian/patches/0005-use-systemd-as-the-default-service-provider.patch
+++ b/debian/patches/0005-use-systemd-as-the-default-service-provider.patch
@@ -1,13 +1,16 @@
-Author: Apollon Oikonomopoulos <apoi...@debian.org>
-Description: Mark systemd as the default service provider for Debian
- Currently systemd is marked as the default service provider only for Jessie.
- Instead of extending this to Stretch, mark it as the default for Debian and
- let the provider confinement blacklist systemd if /run/systemd/system does not
- exist.
-Last-Update: 2017-02-09
+From: Puppet Package Maintainers <pkg-puppet-de...@lists.alioth.debian.org>
+Date: Fri, 21 Jul 2017 12:12:55 +0200
+Subject: use-systemd-as-the-default-service-provider
+
+---
+ lib/puppet/provider/service/systemd.rb | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/puppet/provider/service/systemd.rb b/lib/puppet/provider/service/systemd.rb
+index 9e09f45..6139341 100644
 --- a/lib/puppet/provider/service/systemd.rb
 +++ b/lib/puppet/provider/service/systemd.rb
-@@ -23,8 +23,8 @@
+@@ -23,8 +23,8 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
    defaultfor :osfamily => :redhat, :operatingsystem => :fedora
    defaultfor :osfamily => :suse
    defaultfor :osfamily => :coreos
diff --git a/debian/patches/0006-debian-service-provider-use-service.patch b/debian/patches/0006-debian-service-provider-use-service.patch
index 90b90f5f6..735c59ffd 100644
--- a/debian/patches/0006-debian-service-provider-use-service.patch
+++ b/debian/patches/0006-debian-service-provider-use-service.patch
@@ -1,18 +1,24 @@
 From: Gaudenz Steinlin <gaud...@debian.org>
-Subject: Use /usr/sbin/service for service management on Debian
- In Debian jessie systemd will be the default init system. But the old system V
- and other alternative init systems are still supported. /usr/sbin/service
- provides an abstraction layer which is able to start, stop and restart
- services independent of the init system used.
+Date: Fri, 21 Jul 2017 12:12:55 +0200
+Subject: Use /usr/sbin/service for service management on Debian In Debian
+ jessie systemd will be the default init system. But the old system V and
+ other alternative init systems are still supported. /usr/sbin/service
+ provides an abstraction layer which is able to start,
+ stop and restart services independent of the init system used.
 
 Bug: https://tickets.puppetlabs.com/browse/PUP-2023
 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775795
 Comment: Initially for puppet 3.7, ported to puppet 4.8 by Apollon
  Oikonomopoulos <apoi...@debian.org>
 ---
+ lib/puppet/provider/service/debian.rb | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb
+index 554fc20..7995a95 100644
 --- a/lib/puppet/provider/service/debian.rb
 +++ b/lib/puppet/provider/service/debian.rb
-@@ -60,6 +60,21 @@
+@@ -65,6 +65,21 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
      update_rc @resource[:name], "defaults"
    end
  
diff --git a/debian/patches/0007-Fix-service-listing-and-enable-disable-in-Debian.patch b/debian/patches/0007-Fix-service-listing-and-enable-disable-in-Debian.patch
index e4ed28185..9049f48b5 100644
--- a/debian/patches/0007-Fix-service-listing-and-enable-disable-in-Debian.patch
+++ b/debian/patches/0007-Fix-service-listing-and-enable-disable-in-Debian.patch
@@ -1,9 +1,8 @@
-From a9b76dbfba96f537227c445297d3ccd115de46ca Mon Sep 17 00:00:00 2001
 From: Apollon Oikonomopoulos <apoi...@debian.org>
 Date: Fri, 27 Feb 2015 10:55:34 +0200
-Subject: [PATCH] Fix service listing and enable/disable in Debian
+Subject: Fix service listing and enable/disable in Debian
 MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
+Content-Type: text/plain; charset="utf-8"
 Content-Transfer-Encoding: 8bit
 
  • Under systemd, use systemctl enable/disable for all services. This
@@ -17,12 +16,14 @@ Content-Transfer-Encoding: 8bit
    all services when running under sysv-rc; in addition to simplifying things,
    this also preserves any ordering changes across enable/disable.
 ---
- lib/puppet/provider/service/debian.rb | 94 ++++++++++++++++++++++++++---------
- 1 file changed, 71 insertions(+), 23 deletions(-)
+ lib/puppet/provider/service/debian.rb | 85 +++++++++++++++++++++++++----------
+ 1 file changed, 62 insertions(+), 23 deletions(-)
 
+diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb
+index 7995a95..e0fdd42 100644
 --- a/lib/puppet/provider/service/debian.rb
 +++ b/lib/puppet/provider/service/debian.rb
-@@ -16,43 +16,78 @@
+@@ -16,43 +16,78 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
    # is resolved.
    commands :invoke_rc => "/usr/sbin/invoke-rc.d"
    commands :service => "/usr/sbin/service"
@@ -74,7 +75,18 @@ Content-Transfer-Encoding: 8bit
 -    # TODO: Replace system call when Puppet::Util::Execution.execute gives us a way
 -    # to determine exit status.  https://projects.puppetlabs.com/issues/2538
 -    system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start")
--
++    if self.class.runs_on_systemd?
++      begin
++        systemctl("is-enabled", @resource[:name])
++        return :true
++      rescue Puppet::ExecutionFailure
++        return :false
++      end
++    else
++      # TODO: Replace system call when Puppet::Util::Execution.execute gives us a way
++      # to determine exit status.  https://projects.puppetlabs.com/issues/2538
++      system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start")
+ 
 -    # 104 is the exit status when you query start an enabled service.
 -    # 106 is the exit status when the policy layer supplies a fallback action
 -    # See x-man-page://invoke-rc.d
@@ -87,25 +99,11 @@ Content-Transfer-Encoding: 8bit
 -      # For those that do not, perform the checks manually
 -      # http://www.debian.org/doc/debian-policy/ch-opersys.html
 -      if get_start_link_count >= 4
-+    if self.class.runs_on_systemd?
-+      begin
-+        systemctl("is-enabled", @resource[:name])
-         return :true
--      else
-+      rescue Puppet::ExecutionFailure
-         return :false
-       end
-     else
--      return :false
-+      # TODO: Replace system call when Puppet::Util::Execution.execute gives us a way
-+      # to determine exit status.  https://projects.puppetlabs.com/issues/2538
-+      system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start")
-+
 +      # 104 is the exit status when you query start an enabled service.
 +      # 106 is the exit status when the policy layer supplies a fallback action
 +      # See x-man-page://invoke-rc.d
 +      if [104, 106].include?($CHILD_STATUS.exitstatus)
-+        return :true
+         return :true
 +      elsif [101, 105].include?($CHILD_STATUS.exitstatus)
 +        # 101 is action not allowed, which means we have to do the check manually.
 +        # 105 is unknown, which generally means the iniscript does not support query
@@ -117,13 +115,15 @@ Content-Transfer-Encoding: 8bit
 +        else
 +          return :false
 +        end
-+      else
-+        return :false
-+      end
+       else
+         return :false
+       end
+-    else
+-      return :false
      end
    end
  
-@@ -61,8 +96,12 @@
+@@ -61,8 +96,12 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
    end
  
    def enable
diff --git a/debian/patches/0008-fix-locale-loading.patch b/debian/patches/0008-fix-locale-loading.patch
index 95999a090..160de62d7 100644
--- a/debian/patches/0008-fix-locale-loading.patch
+++ b/debian/patches/0008-fix-locale-loading.patch
@@ -1,10 +1,16 @@
-Author: Apollon Oikonomopoulos <apoi...@debian.org>
-Description: Override local loading path
- Use the package's /usr/share/puppet/locale instead of /usr/share/locale.
-Bug-Debian: https://bugs.debian.org/866972
+From: Puppet Package Maintainers <pkg-puppet-de...@lists.alioth.debian.org>
+Date: Fri, 21 Jul 2017 12:12:55 +0200
+Subject: fix-locale-loading
+
+---
+ lib/puppet.rb | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/puppet.rb b/lib/puppet.rb
+index 1660caa..f4ed9b3 100644
 --- a/lib/puppet.rb
 +++ b/lib/puppet.rb
-@@ -31,7 +31,7 @@
+@@ -31,7 +31,7 @@ begin
    # e.g. ~/code/puppet/locales. Also when running as a gem.
    local_locale_path = File.absolute_path('../locales', File.dirname(__FILE__))
    # e.g. /opt/puppetlabs/puppet/share/locale
-- 
2.13.2

Reply via email to