From 8a885fc38f9d838c584786a3fea227232463e1f4 Mon Sep 17 00:00:00 2001 From: Lendar Date: Tue, 16 Dec 2014 20:46:48 +0300 Subject: [PATCH] Fix PUT/DELETE in s3.query Was broken in 8ed7c92 during move to requests. - PUT now uploads data - Fixes AttributeError --- salt/utils/s3.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/salt/utils/s3.py b/salt/utils/s3.py index b582766061..cea5fabf3a 100644 --- a/salt/utils/s3.py +++ b/salt/utils/s3.py @@ -150,6 +150,7 @@ def query(key, keyid, method='GET', params=None, headers=None, try: result = requests.request(method, requesturl, headers=headers, + data=data, verify=verify_ssl) response = result.content except requests.exceptions.HTTPError as exc: @@ -162,7 +163,7 @@ def query(key, keyid, method='GET', params=None, headers=None, log.debug('S3 Response Status Code: {0}'.format(result.status_code)) if method == 'PUT': - if result.getcode() == 200: + if result.status_code == 200: if local_file: log.debug('Uploaded from {0} to {1}'.format(local_file, path)) else: @@ -172,14 +173,14 @@ def query(key, keyid, method='GET', params=None, headers=None, log.debug('Failed to upload from {0} to {1}: {2}'.format( local_file, path, - result.getcode(), + result.status_code, )) else: log.debug('Failed to create bucket {0}'.format(bucket)) return if method == 'DELETE': - if str(result.getcode()).startswith('2'): + if str(result.status_code).startswith('2'): if path: log.debug('Deleted {0} from bucket {1}'.format(path, bucket)) else: @@ -189,7 +190,7 @@ def query(key, keyid, method='GET', params=None, headers=None, log.debug('Failed to delete {0} from bucket {1}: {2}'.format( path, bucket, - result.getcode(), + result.status_code, )) else: log.debug('Failed to delete bucket {0}'.format(bucket))