Package: apt-transport-s3
Version: 1.2.1-1
Severity: normal

Hi,
the error handling in 1.2.1 is very terse e.g.

Err:7 s3://secsys-aptly.s3.amazonaws.com stretch/main amd64 Packages
  400  Bad Request

The attached patch backports the error handling from 1.3.0 so one at
least gets an idea what error one is hitting:

  Err:9 s3://secsys-aptly.s3.amazonaws.com stretch/main amd64 Packages
  400  HTTP Error 400: Bad Request - The authorization mechanism you have 
provided is not supported. Please use AWS4-HMAC-SHA256.

Please consider this for inclusion in a stretch p-u upload.
Cheers,
 -- Guido

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 
'testing-debug'), (500, 'stable-updates'), (500, 'oldoldstable'), (500, 
'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages apt-transport-s3 depends on:
ii  apt               1.6~alpha5
ii  python            2.7.14-1
ii  python-configobj  5.0.6-2

apt-transport-s3 recommends no packages.

apt-transport-s3 suggests no packages.

-- no debconf information
>From 59810afd170b151a494a7df78916ca344f68a0f8 Mon Sep 17 00:00:00 2001
Message-Id: <59810afd170b151a494a7df78916ca344f68a0f8.1511889531.git....@sigxcpu.org>
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <a...@sigxcpu.org>
Date: Tue, 28 Nov 2017 18:17:39 +0100
Subject: [PATCH] Backport error handling

---
 s3 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/s3 b/s3
index d2e6649..2adbaf1 100755
--- a/s3
+++ b/s3
@@ -22,6 +22,7 @@ import hmac
 import json
 import sys
 import os
+import xml.etree.ElementTree as ET
 from configobj import ConfigObj
 
 import syslog
@@ -154,6 +155,13 @@ class AWSCredentials(object):
             # HTTPError is a "file like object" similar to what
             # urllib2.urlopen returns, so return it and let caller
             # deal with the error code
+            if e.code == 400:
+                # token errors are buried in 400 messages so expose
+                xmlResponse = ET.fromstring(e.read())
+                if xmlResponse is not None:
+                    e.msg = "{} - {}".format(e, xmlResponse.find("Message").text)
+            if e.code == 301:
+                e.msg = "{} - Set s3auth.conf region to match bucket 'Region'".format(e)
             return e
         # For other errors, throw an exception directly
         except urllib2.URLError as e:
-- 
2.15.0

Reply via email to