summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.rst4
-rw-r--r--boto/__init__.py2
-rw-r--r--boto/cloudsearch2/search.py4
-rw-r--r--boto/provider.py5
-rw-r--r--docs/source/index.rst1
-rw-r--r--docs/source/releasenotes/v2.29.1.rst11
-rw-r--r--tests/unit/cloudsearch2/test_search.py4
-rw-r--r--tests/unit/provider/test_provider.py47
8 files changed, 70 insertions, 8 deletions
diff --git a/README.rst b/README.rst
index 6bc38e28..843a8a1d 100644
--- a/README.rst
+++ b/README.rst
@@ -1,9 +1,9 @@
####
boto
####
-boto 2.29.0
+boto 2.29.1
-Released: 29-May-2014
+Released: 30-May-2014
.. image:: https://travis-ci.org/boto/boto.png?branch=develop
:target: https://travis-ci.org/boto/boto
diff --git a/boto/__init__.py b/boto/__init__.py
index 95bbf334..de578ab1 100644
--- a/boto/__init__.py
+++ b/boto/__init__.py
@@ -37,7 +37,7 @@ import logging.config
import urlparse
from boto.exception import InvalidUriError
-__version__ = '2.29.0'
+__version__ = '2.29.1'
Version = __version__ # for backware compatibility
# http://bugs.python.org/issue7980
diff --git a/boto/cloudsearch2/search.py b/boto/cloudsearch2/search.py
index 52dbfca5..6e4c3527 100644
--- a/boto/cloudsearch2/search.py
+++ b/boto/cloudsearch2/search.py
@@ -156,6 +156,8 @@ class SearchConnection(object):
def __init__(self, domain=None, endpoint=None):
self.domain = domain
self.endpoint = endpoint
+ self.session = requests.Session()
+
if not endpoint:
self.endpoint = domain.search_service_endpoint
@@ -278,7 +280,7 @@ class SearchConnection(object):
url = "http://%s/%s/search" % (self.endpoint, api_version)
params = query.to_params()
- r = requests.get(url, params=params)
+ r = self.session.get(url, params=params)
try:
data = json.loads(r.content)
except ValueError, e:
diff --git a/boto/provider.py b/boto/provider.py
index 8b1a7df6..148d9404 100644
--- a/boto/provider.py
+++ b/boto/provider.py
@@ -189,7 +189,7 @@ class Provider(object):
self._credential_expiry_time = None
# Load shared credentials file if it exists
- shared_path = os.path.join(expanduser('~'), '.aws', 'credentials')
+ shared_path = os.path.join(expanduser('~'), '.' + name, 'credentials')
self.shared_credentials = Config(do_load=False)
if os.path.exists(shared_path):
self.shared_credentials.load_from_path(shared_path)
@@ -265,7 +265,8 @@ class Provider(object):
# Load profile from shared environment variable if it was not
# already passed in and the environment variable exists
- if profile_name is None and profile_name_name.upper() in os.environ:
+ if profile_name is None and profile_name_name is not None and \
+ profile_name_name.upper() in os.environ:
profile_name = os.environ[profile_name_name.upper()]
shared = self.shared_credentials
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 4b805a6d..c97d3919 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -119,6 +119,7 @@ Release Notes
.. toctree::
:titlesonly:
+ releasenotes/v2.29.1
releasenotes/v2.29.0
releasenotes/v2.28.0
releasenotes/v2.27.0
diff --git a/docs/source/releasenotes/v2.29.1.rst b/docs/source/releasenotes/v2.29.1.rst
new file mode 100644
index 00000000..12122ce7
--- /dev/null
+++ b/docs/source/releasenotes/v2.29.1.rst
@@ -0,0 +1,11 @@
+boto v2.29.1
+============
+
+:date: 2014/05/30
+
+This release fixes a critical bug when the provider is not set to ``aws``, e.g. for Google Storage. It also fixes a problem with connection pooling in Amazon CloudSearch.
+
+Changes
+-------
+* Fix crash when provider is google. (:issue:`2302`, :sha:`33329d5888`)
+* Fix connection pooling issue with CloudSearch (:sha:`82e83be12a`)
diff --git a/tests/unit/cloudsearch2/test_search.py b/tests/unit/cloudsearch2/test_search.py
index e40dc396..cef4b959 100644
--- a/tests/unit/cloudsearch2/test_search.py
+++ b/tests/unit/cloudsearch2/test_search.py
@@ -350,7 +350,7 @@ class CloudSearchConnectionTest(unittest.TestCase):
fake.content = 'Nopenopenope'
# First, in the case of a non-JSON, non-403 error.
- with mpo(requests, 'get', return_value=fake) as mock_request:
+ with mpo(self.conn.session, 'get', return_value=fake) as mock_request:
with self.assertRaises(SearchServiceException) as cm:
self.conn.search(q='not_gonna_happen')
@@ -362,7 +362,7 @@ class CloudSearchConnectionTest(unittest.TestCase):
'error': "Something went wrong. Oops."
})
- with mpo(requests, 'get', return_value=fake) as mock_request:
+ with mpo(self.conn.session, 'get', return_value=fake) as mock_request:
with self.assertRaises(SearchServiceException) as cm:
self.conn.search(q='no_luck_here')
diff --git a/tests/unit/provider/test_provider.py b/tests/unit/provider/test_provider.py
index d8949ca2..b8141451 100644
--- a/tests/unit/provider/test_provider.py
+++ b/tests/unit/provider/test_provider.py
@@ -3,8 +3,10 @@ from datetime import datetime, timedelta
from tests.unit import unittest
import mock
+import os
from boto import provider
+from boto.compat import expanduser
INSTANCE_CONFIG = {
@@ -371,6 +373,51 @@ class TestProvider(unittest.TestCase):
timeout=4.0, num_retries=10,
data='meta-data/iam/security-credentials/')
+ def test_provider_google(self):
+ self.environ['GS_ACCESS_KEY_ID'] = 'env_access_key'
+ self.environ['GS_SECRET_ACCESS_KEY'] = 'env_secret_key'
+ self.shared_config = {
+ 'default': {
+ 'gs_access_key_id': 'shared_access_key',
+ 'gs_secret_access_key': 'shared_secret_key',
+ }
+ }
+ self.config = {
+ 'Credentials': {
+ 'gs_access_key_id': 'cfg_access_key',
+ 'gs_secret_access_key': 'cfg_secret_key',
+ }
+ }
+ p = provider.Provider('google')
+ self.assertEqual(p.access_key, 'env_access_key')
+ self.assertEqual(p.secret_key, 'env_secret_key')
+
+ self.environ.clear()
+ p = provider.Provider('google')
+ self.assertEqual(p.access_key, 'shared_access_key')
+ self.assertEqual(p.secret_key, 'shared_secret_key')
+
+ self.shared_config.clear()
+ p = provider.Provider('google')
+ self.assertEqual(p.access_key, 'cfg_access_key')
+ self.assertEqual(p.secret_key, 'cfg_secret_key')
+
+ @mock.patch('os.path.exists', return_value=True)
+ @mock.patch.object(provider.Config, 'load_from_path')
+ def test_shared_config_loading(self, load_from_path, exists):
+ provider.Provider('aws')
+ path = os.path.join(expanduser('~'), '.aws', 'credentials')
+ exists.assert_called_once_with(path)
+ load_from_path.assert_called_once_with(path)
+
+ exists.reset_mock()
+ load_from_path.reset_mock()
+
+ provider.Provider('google')
+ path = os.path.join(expanduser('~'), '.google', 'credentials')
+ exists.assert_called_once_with(path)
+ load_from_path.assert_called_once_with(path)
+
if __name__ == '__main__':
unittest.main()