1
Description: Harden version checking for boto
2
Simple string comparison is not effective for version checking.
3
Let's switch to using pkg_resources.parse_version and compare
5
Origin: https://review.openstack.org/#/c/51426/
6
Bug: https://bugs.launchpad.net/nova/+bug/1239220
8
Index: nova/nova/tests/api/ec2/test_api.py
9
===================================================================
10
--- nova.orig/nova/tests/api/ec2/test_api.py 2013-12-12 13:18:41.027183269 -0800
11
+++ nova/nova/tests/api/ec2/test_api.py 2013-12-12 13:18:41.023183269 -0800
14
"""Unit tests for the API endpoint."""
21
self.http = FakeHttplibConnection(
22
self.app, '%s:8773' % (self.host), False)
23
# pylint: disable=E1103
24
- if boto.Version >= '2.14':
25
+ boto_version = pkg_resources.parse_version(boto.Version)
26
+ if boto_version >= pkg_resources.parse_version('2.13'):
27
self.ec2.new_http_connection(host or self.host, 8773,
28
is_secure).AndReturn(self.http)
29
- elif boto.Version >= '2':
30
+ elif boto_version >= pkg_resources.parse_version('2'):
31
self.ec2.new_http_connection(host or '%s:8773' % (self.host),
32
is_secure).AndReturn(self.http)