Skip to content

Commit

Permalink
Add boto special casing for param changes in 2.14
Browse files Browse the repository at this point in the history
boto 2.14 has some interface changes with the get_http_connection
call which adds port as a non optional parameter *in the middle of*
existing non optional parameters. It's a special kind of incompatible
change.

We are already special casing around boto in the unit tests, lets
just do more of that if we are running on a newer version.

(cherry picked from commit 1ce493b)

Co-Authored-By: Dan Smith <dansmith@redhat.com>
Closes-bug: #1237944
Change-Id: If388d872286eca15bf24a582db1bac22224a8b24
  • Loading branch information
Sean Dague and kk7ds committed Oct 10, 2013
1 parent 96d828f commit 7161c62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion nova/tests/api/ec2/test_api.py
Expand Up @@ -272,7 +272,10 @@ def expect_http(self, host=None, is_secure=False, api_version=None):
self.http = FakeHttplibConnection(
self.app, '%s:8773' % (self.host), False)
# pylint: disable=E1103
if boto.Version >= '2':
if boto.Version >= '2.14':
self.ec2.new_http_connection(host or self.host, 8773,
is_secure).AndReturn(self.http)
elif boto.Version >= '2':
self.ec2.new_http_connection(host or '%s:8773' % (self.host),
is_secure).AndReturn(self.http)
else:
Expand Down
10 changes: 8 additions & 2 deletions nova/tests/test_objectstore.py
Expand Up @@ -77,9 +77,15 @@ def setUp(self):
calling_format=s3.OrdinaryCallingFormat())
self.conn = conn

def get_http_connection(host, is_secure):
def get_http_connection(*args):
"""Get a new S3 connection, don't attempt to reuse connections."""
return self.conn.new_http_connection(host, is_secure)
try:
# NOTE(danms): boto < 2.14
host, is_secure = args
return self.conn.new_http_connection(host, is_secure)
except ValueError:
host, port, is_secure = args
return self.conn.new_http_connection(host, port, is_secure)

self.conn.get_http_connection = get_http_connection

Expand Down

0 comments on commit 7161c62

Please sign in to comment.