Skip to content

Commit

Permalink
Merge pull request #30126 from stanislavb/2015.8
Browse files Browse the repository at this point in the history
Log S3 API error message
  • Loading branch information
Mike Place committed Jan 4, 2016
2 parents aeec21e + 8c4a101 commit c06671a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions salt/utils/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,15 @@ def query(key, keyid, method='GET', params=None, headers=None,
if not data:
data = None

try:
result = requests.request(method, requesturl, headers=headers,
data=data,
verify=verify_ssl)
response = result.content
except requests.exceptions.HTTPError as exc:
log.error('Failed to {0} {1}::'.format(method, requesturl))
log.error(' Exception: {0}'.format(exc))
if exc.response:
log.error(' Response content: {0}'.format(exc.response.content))
return False
result = requests.request(method,
requesturl,
headers=headers,
data=data,
verify=verify_ssl)
response = result.content
if result.status_code >= 400:
# On error the S3 API response should contain error message
log.debug(' Response content: {0}'.format(response))

log.debug('S3 Response Status Code: {0}'.format(result.status_code))

Expand Down

0 comments on commit c06671a

Please sign in to comment.