Skip to content

Prod Deploy #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 109 commits into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
96fb5a1
issue2573 Bugfix for boto.dynamodb2.table.Table#query_count where a C…
Oct 14, 2014
d46dc27
issue2573 Fixing line length based on PR feedback
Oct 17, 2014
86f2ecc
Parse ClusterStatus’es StateChangeReason.
paxan Oct 20, 2014
5ef9d64
Url encode query string for pure query
kyleknap Oct 29, 2014
a60ee4c
Anonymous sts connection does not search for creds
kyleknap Oct 30, 2014
1a51599
Add docstring for sts anon
kyleknap Oct 30, 2014
bbbf9d2
Merge pull request #2720 from kyleknap/sts-anonymous
kyleknap Oct 31, 2014
3f5e16d
Improve handling of HTTP 204 responses.
twirrim Oct 31, 2014
c6108b2
correct argument type in doc string
Nov 2, 2014
5b093d6
fix raising exception syntax in python 3
youngrok Nov 5, 2014
859f03a
fix for s3put host specification - issue #2522
srri Nov 5, 2014
20b54b6
Handle sigv4 non-string header values properly
kyleknap Nov 7, 2014
3f5ed60
Add a unit test
kyleknap Nov 8, 2014
e043e4b
Merge pull request #2744 from kyleknap/int-headers
kyleknap Nov 8, 2014
730d817
changed where host is handled
srri Nov 9, 2014
48b9a75
Fix EMR endpoint
danielgtaylor Nov 12, 2014
8b089b2
iam: add support for Account Password Policy APIs
Aug 28, 2014
e561ee8
tests: add tests for IAM Account Password Policy APIs
Sep 5, 2014
a788932
tests: properly tag IAM integration tests
Sep 5, 2014
a836a0a
minor documentation fixes
Nov 12, 2014
d3463b5
fix pep8
Nov 12, 2014
6c9bd53
Merge pull request #2574 from lucab/lucab/to-upstream/iam-password-po…
kyleknap Nov 12, 2014
f855362
Updated link to current config documentation
pochmann Nov 13, 2014
deae611
Add cloudsearchdomain
kyleknap Nov 5, 2014
62e5e39
Sign request headers for uploads and search
Nov 17, 2014
9f4fe8b
Merge pull request #2717 from andersenyang/cloudsearchAuth
kyleknap Nov 17, 2014
b7f8369
Throw host warning for cloudsearch domain
kyleknap Nov 18, 2014
9af6f41
Merge pull request #2765 from kyleknap/cloudsearchdomain-warning
kyleknap Nov 18, 2014
01011d7
Fix the SQS certificate error for region cn-north-1
alexzhangs Nov 19, 2014
5f46738
Detect old-style S3 URL for auto-sigv4.
danielgtaylor Nov 20, 2014
f5be409
Merge pull request #2773 from danielgtaylor/sigv4-detect
danielgtaylor Nov 20, 2014
8329e02
Merge pull request #2750 from boto/emr-fix
danielgtaylor Nov 20, 2014
9752747
fix: snap.create_volume documentation lists general purpose ssd
dsharkey Nov 21, 2014
5e55dc2
Adds SupportedProducts field to EMR JobFlow objects.
danielgtaylor Nov 21, 2014
6771d04
Merge pull request #2775 from boto/emr-supported-products
danielgtaylor Nov 21, 2014
48c5d17
Merge pull request #2696 from paxan/clusterstatus-statechangereason
kyleknap Nov 26, 2014
90fe966
Fixed param type in get_contents_to_filename docstring
Nov 28, 2014
daefa71
Add support for private hosted zones
djcross Dec 1, 2014
08f187a
Update to include fake access key
frankamp Dec 2, 2014
0c7fc6d
add get_checker_ip_ranges method
Dec 2, 2014
fad0d31
add unit test
Dec 2, 2014
02a6aed
Added 'end' attribute to ReservedInstance
wonderb0lt Dec 2, 2014
28814d8
Merge pull request #2793 from wonderb0lt/reservedinstances-enddate
danielgtaylor Dec 2, 2014
2c1f8d5
Merge pull request #2791 from frankamp/patch-2
danielgtaylor Dec 2, 2014
f0bd2d7
update unit test
Dec 2, 2014
478f66a
Merge pull request #2783 from kotik/develop
danielgtaylor Dec 2, 2014
36fae2b
Merge pull request #2774 from dsharkey/fix-create-volume-docs
danielgtaylor Dec 2, 2014
e3fe2c2
Remove unneccessary super call
danielgtaylor Dec 2, 2014
ee14911
Merge branch 'zihaoyu-route53_checker_ip_ranges' into develop
danielgtaylor Dec 2, 2014
1d5368a
Merge pull request #2766 from alexzhangs/develop
danielgtaylor Dec 2, 2014
9be3f85
Merge pull request #2755 from pochmann/patch-1
danielgtaylor Dec 2, 2014
419d8a5
Merge pull request #2676 from lapointexavier/feature/issue-2573-bugfi…
danielgtaylor Dec 3, 2014
1ddf6df
Merge pull request #2728 from ntrepid8/route53_docstring_update
danielgtaylor Dec 3, 2014
6a853be
Merge pull request #2753 from catlee/docs
danielgtaylor Dec 3, 2014
7a38bea
Add Check privateZone == false to create_hosted_zone unit test
djcross Dec 3, 2014
ea17b48
Fixing comparison for PrivateZone test
Dec 3, 2014
b577ab8
committing for the night. test is currently failing
Dec 3, 2014
a2a6a78
fix previous test, add test to make sure 400 is returned
Dec 3, 2014
56244b6
Change from camelcase to underscore to keep with convention
djcross Dec 3, 2014
aa9137b
add integration test for creating a private zone
Dec 4, 2014
2799af6
clean up private zone test
Dec 4, 2014
d1ff14e
Merge pull request #1 from Twistedpear/privatezone
djcross Dec 4, 2014
a3af034
update private zone tests to work with changed vpc_id and vpc_region …
djcross Dec 4, 2014
c5719c7
Add to documentation/usage comment
djcross Dec 4, 2014
58f76f6
Merge pull request #2735 from youngrok/develop
danielgtaylor Dec 6, 2014
c314298
Merge pull request #2726 from twirrim/develop
danielgtaylor Dec 6, 2014
f43e255
added test cases for host parameter
srri Dec 6, 2014
f434adc
changed logic to be safer
srri Dec 6, 2014
48c64cc
attempt to add authentication
srri Dec 6, 2014
f149c13
moved to integration
srri Dec 6, 2014
73dc86b
remove unimplemented config param. - #2572
srri Dec 7, 2014
0612292
update documentation for launchconfig
Dec 8, 2014
5e1650a
change string to str on doc
Dec 8, 2014
e64c998
Shorten long lines
djcross Dec 8, 2014
b32fa4e
Shortened more lines
djcross Dec 8, 2014
5102fbe
Shorten more lines
djcross Dec 9, 2014
e25478e
Shortened a few more lines in test files
djcross Dec 9, 2014
134c6f2
Pass version_id in copy if key is versioned
sblosser Dec 9, 2014
e991e29
Fix Key.change_storage_class so that it obeys dst_bucket
Nov 12, 2014
cca0d3a
Add support for SQS PurgeQueue operation.
zvickery Dec 11, 2014
68e8cd6
Added suppport for additional fields in ClusterSummary and Cluster ob…
dennisatplumbee Dec 12, 2014
f57f2b7
Due to batching an empty result does not imply there are no results l…
Dec 15, 2014
21e9191
Added test to cover empty batch result in a batch_get operation. All …
Dec 15, 2014
5506aba
FIXING SES get_identity_dkim_attributes fails when input length > 1
Dec 15, 2014
58f6e24
Correct join syntax
bhagany Dec 17, 2014
1af31f2
Merge pull request #2736 from Captainkrtek/Fix_S3Put_host
danielgtaylor Dec 17, 2014
55ed184
Merge pull request #2752 from catlee/storage_class
danielgtaylor Dec 17, 2014
2e7829b
Merge pull request #2785 from djcross/privatezone
danielgtaylor Dec 17, 2014
f1a5ebd
Merge pull request #2801 from Captainkrtek/fix_2572
danielgtaylor Dec 17, 2014
0dc8412
Merge pull request #2802 from MisaKondo/update-launchconfig-docs
danielgtaylor Dec 17, 2014
73ae3b7
Added ELB Attributes to docs
Dec 17, 2014
01b5246
Return SetStackPolicyResponse - Fixes #2346 #2639
Dec 17, 2014
90a5d44
Merge pull request #2806 from zvickery/develop
danielgtaylor Dec 18, 2014
9fad1db
Fix set_stack_policy test
Dec 18, 2014
230cf17
Adding unit test for boto/boto#2803
sblosser Dec 18, 2014
66b3604
Merge pull request #2803 from sblosser/patch-1
danielgtaylor Dec 18, 2014
2936ac0
Merge pull request #2807 from dennisatplumbee/develop
danielgtaylor Dec 18, 2014
a193bc0
Merge pull request #2809 from serviceagility/develop
danielgtaylor Dec 18, 2014
cc4d42d
Merge pull request #2810 from monkeysecurity/develop
danielgtaylor Dec 18, 2014
ffccaed
Add test for _sandboxify
bhagany Dec 20, 2014
eebcb11
Add missing comma
bhagany Dec 20, 2014
8426148
Merge pull request #2817 from bhagany/patch-1
danielgtaylor Dec 22, 2014
5dfeba9
Merge pull request #2821 from micahhausler/documentation/elb
danielgtaylor Dec 22, 2014
32abe3e
Switch elb/ec2 over to signature version 4
jamesls Dec 23, 2014
27c83c1
Add integ tests for sigv4 switchover
jamesls Dec 23, 2014
fa5ef7f
Remove unnecessary assertion
Dec 23, 2014
c4defb4
Merge pull request #2822 from micahhausler/bugfix/cloudformation_set_…
danielgtaylor Dec 23, 2014
0dadce8
Merge branch 'switchover-sigv4' into develop
jamesls Dec 23, 2014
1f0071c
Set version_id to None when 'null' is returned from s3
Dec 30, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ At the moment, boto supports:
* Application Services

* Amazon CloudSearch (Python 3)
* Amazon CloudSearch Domain (Python 3)
* Amazon Elastic Transcoder (Python 3)
* Amazon Simple Workflow Service (SWF) (Python 3)
* Amazon Simple Queue Service (SQS) (Python 3)
Expand Down Expand Up @@ -179,7 +180,7 @@ boto config file. See `this`_ for details.
.. _github.com: http://github.com/boto/boto
.. _Online documentation: http://docs.pythonboto.org
.. _Python Cheese Shop: http://pypi.python.org/pypi/boto
.. _this: http://code.google.com/p/boto/wiki/BotoConfig
.. _this: http://docs.pythonboto.org/en/latest/boto_config_tut.html
.. _gitflow: http://nvie.com/posts/a-successful-git-branching-model/
.. _neo: https://github.com/boto/boto/tree/neo
.. _boto-users Google Group: https://groups.google.com/forum/?fromgroups#!forum/boto-users
24 changes: 24 additions & 0 deletions boto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ def connect_cloudsearch(aws_access_key_id=None,

def connect_cloudsearch2(aws_access_key_id=None,
aws_secret_access_key=None,
sign_request=False,
**kwargs):
"""
:type aws_access_key_id: string
Expand All @@ -672,14 +673,37 @@ def connect_cloudsearch2(aws_access_key_id=None,
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key

:type sign_request: bool
:param sign_request: whether or not to sign search and
upload requests

:rtype: :class:`boto.cloudsearch2.layer2.Layer2`
:return: A connection to Amazon's CloudSearch2 service
"""
from boto.cloudsearch2.layer2 import Layer2
return Layer2(aws_access_key_id, aws_secret_access_key,
sign_request=sign_request,
**kwargs)


def connect_cloudsearchdomain(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID

:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key

:rtype: :class:`boto.cloudsearchdomain.layer1.CloudSearchDomainConnection`
:return: A connection to Amazon's CloudSearch Domain service
"""
from boto.cloudsearchdomain.layer1 import CloudSearchDomainConnection
return CloudSearchDomainConnection(aws_access_key_id,
aws_secret_access_key, **kwargs)


def connect_beanstalk(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
Expand Down
30 changes: 22 additions & 8 deletions boto/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
sha256 = None


# Region detection strings to determine if SigV4 should be used
# by default.
SIGV4_DETECT = [
'.cn-',
# In eu-central we support both host styles for S3
'.eu-central',
'-eu-central',
]


class HmacKeys(object):
"""Key based Auth handler helper."""

Expand Down Expand Up @@ -359,7 +369,7 @@ def canonical_headers(self, headers_to_sign):

for header in headers_to_sign:
c_name = header.lower().strip()
raw_value = headers_to_sign[header]
raw_value = str(headers_to_sign[header])
if '"' in raw_value:
c_value = raw_value.strip()
else:
Expand Down Expand Up @@ -773,8 +783,11 @@ class QueryAuthHandler(AuthHandler):
capability = ['pure-query']

def _escape_value(self, value):
# Would normally be ``return urllib.parse.quote(value)``.
return value
# This is changed from a previous version because this string is
# being passed to the query string and query strings must
# be url encoded. In particular STS requires the saml_response to
# be urlencoded when calling assume_role_with_saml.
return urllib.parse.quote(value)

def _build_query_string(self, params):
keys = list(params.keys())
Expand Down Expand Up @@ -1000,9 +1013,9 @@ def _wrapper(self):
# ``boto/iam/connection.py``, as several things there are also
# endpoint-related.
if getattr(self.region, 'endpoint', ''):
if '.cn-' in self.region.endpoint or \
'.eu-central' in self.region.endpoint:
return ['hmac-v4']
for test in SIGV4_DETECT:
if test in self.region.endpoint:
return ['hmac-v4']

return func(self)
return _wrapper
Expand All @@ -1020,8 +1033,9 @@ def _wrapper(self):
# If you're making changes here, you should also check
# ``boto/iam/connection.py``, as several things there are also
# endpoint-related.
if '.cn-' in self.host or '.eu-central' in self.host:
return ['hmac-v4-s3']
for test in SIGV4_DETECT:
if test in self.host:
return ['hmac-v4-s3']

return func(self)
return _wrapper
3 changes: 1 addition & 2 deletions boto/cloudformation/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,5 +884,4 @@ def set_stack_policy(self, stack_name_or_id, stack_policy_body=None,
params['StackPolicyURL'] = stack_policy_url

response = self._do_request('SetStackPolicy', params, '/', 'POST')
return response['SetStackPolicyResponse']\
['SetStackPolicyResult']
return response['SetStackPolicyResponse']
93 changes: 63 additions & 30 deletions boto/cloudsearch2/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from boto.compat import json
import requests
import boto
from boto.cloudsearchdomain.layer1 import CloudSearchDomainConnection


class SearchServiceException(Exception):
Expand Down Expand Up @@ -93,11 +94,25 @@ def __init__(self, domain=None, endpoint=None):
self.documents_batch = []
self._sdf = None

# Copy proxy settings from connection
if self.domain and self.domain.layer1 and self.domain.layer1.use_proxy:
self.proxy = {'http': self.domain.layer1.get_proxy_url_with_auth()}
else:
self.proxy = {}
# Copy proxy settings from connection and check if request should be signed
self.proxy = {}
self.sign_request = False
if self.domain and self.domain.layer1:
if self.domain.layer1.use_proxy:
self.proxy = {'http': self.domain.layer1.get_proxy_url_with_auth()}

self.sign_request = getattr(self.domain.layer1, 'sign_request', False)

if self.sign_request:
# Create a domain connection to send signed requests
layer1 = self.domain.layer1
self.domain_connection = CloudSearchDomainConnection(
host=self.endpoint,
aws_access_key_id=layer1.aws_access_key_id,
aws_secret_access_key=layer1.aws_secret_access_key,
region=layer1.region,
provider=layer1.provider
)

def add(self, _id, fields):
"""
Expand Down Expand Up @@ -164,6 +179,26 @@ def add_sdf_from_s3(self, key_obj):

self._sdf = key_obj.get_contents_as_string()

def _commit_with_auth(self, sdf, api_version):
return self.domain_connection.upload_documents(sdf, 'application/json')

def _commit_without_auth(self, sdf, api_version):
url = "http://%s/%s/documents/batch" % (self.endpoint, api_version)

# Keep-alive is automatic in a post-1.0 requests world.
session = requests.Session()
session.proxies = self.proxy
adapter = requests.adapters.HTTPAdapter(
pool_connections=20,
pool_maxsize=50,
max_retries=5
)
session.mount('http://', adapter)
session.mount('https://', adapter)

resp = session.post(url, data=sdf, headers={'Content-Type': 'application/json'})
return resp

def commit(self):
"""
Actually send an SDF to CloudSearch for processing
Expand All @@ -184,24 +219,15 @@ def commit(self):
boto.log.error(sdf[index - 100:index + 100])

api_version = '2013-01-01'
if self.domain:
if self.domain and self.domain.layer1:
api_version = self.domain.layer1.APIVersion
url = "http://%s/%s/documents/batch" % (self.endpoint, api_version)

# Keep-alive is automatic in a post-1.0 requests world.
session = requests.Session()
session.proxies = self.proxy
adapter = requests.adapters.HTTPAdapter(
pool_connections=20,
pool_maxsize=50,
max_retries=5
)
session.mount('http://', adapter)
session.mount('https://', adapter)
r = session.post(url, data=sdf,
headers={'Content-Type': 'application/json'})
if self.sign_request:
r = self._commit_with_auth(sdf, api_version)
else:
r = self._commit_without_auth(sdf, api_version)

return CommitResponse(r, self, sdf)
return CommitResponse(r, self, sdf, signed_request=self.sign_request)


class CommitResponse(object):
Expand All @@ -219,20 +245,24 @@ class CommitResponse(object):
:raises: :class:`boto.cloudsearch2.document.EncodingError`
:raises: :class:`boto.cloudsearch2.document.ContentTooLongError`
"""
def __init__(self, response, doc_service, sdf):
def __init__(self, response, doc_service, sdf, signed_request=False):
self.response = response
self.doc_service = doc_service
self.sdf = sdf
self.signed_request = signed_request

_body = response.content.decode('utf-8')
if self.signed_request:
self.content = response
else:
_body = response.content.decode('utf-8')

try:
self.content = json.loads(_body)
except:
boto.log.error('Error indexing documents.\nResponse Content:\n{0}'
'\n\nSDF:\n{1}'.format(_body, self.sdf))
raise boto.exception.BotoServerError(self.response.status_code, '',
body=_body)
try:
self.content = json.loads(_body)
except:
boto.log.error('Error indexing documents.\nResponse Content:\n{0}'
'\n\nSDF:\n{1}'.format(_body, self.sdf))
raise boto.exception.BotoServerError(self.response.status_code, '',
body=_body)

self.status = self.content['status']
if self.status == 'error':
Expand Down Expand Up @@ -266,7 +296,10 @@ def _check_num_ops(self, type_, response_num):
if d['type'] == type_])

if response_num != commit_num:
boto.log.debug(self.response.content)
if self.signed_request:
boto.log.debug(self.response)
else:
boto.log.debug(self.response.content)
# There will always be a commit mismatch error if there is any
# errors on cloudsearch. self.errors gets lost when this
# CommitMismatchError is raised. Whoever is using boto has no idea
Expand Down
4 changes: 3 additions & 1 deletion boto/cloudsearch2/layer1.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class CloudSearchConnection(AWSQueryConnection):
"BaseException": exceptions.BaseException,
}


def __init__(self, **kwargs):
region = kwargs.pop('region', None)
if not region:
Expand All @@ -66,6 +65,9 @@ def __init__(self, **kwargs):
if 'host' not in kwargs or kwargs['host'] is None:
kwargs['host'] = region.endpoint

sign_request = kwargs.pop('sign_request', False)
self.sign_request = sign_request

super(CloudSearchConnection, self).__init__(**kwargs)
self.region = region

Expand Down
5 changes: 3 additions & 2 deletions boto/cloudsearch2/layer2.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Layer2(object):
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
is_secure=True, port=None, proxy=None, proxy_port=None,
host=None, debug=0, session_token=None, region=None,
validate_certs=True):
validate_certs=True, sign_request=False):

if isinstance(region, six.string_types):
import boto.cloudsearch2
Expand All @@ -52,7 +52,8 @@ def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
debug=debug,
security_token=session_token,
region=region,
validate_certs=validate_certs)
validate_certs=validate_certs,
sign_request=sign_request)

def list_domains(self, domain_names=None):
"""
Expand Down
Loading