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
--- a/nova/tests/api/ec2/test_api.py
9
+++ b/nova/tests/api/ec2/test_api.py
12
"""Unit tests for the API endpoint."""
18
@@ -272,10 +273,11 @@ class ApiEc2TestCase(test.TestCase):
19
self.http = FakeHttplibConnection(
20
self.app, '%s:8773' % (self.host), False)
21
# pylint: disable=E1103
22
- if boto.Version >= '2.14':
23
+ boto_version = pkg_resources.parse_version(boto.Version)
24
+ if boto_version >= pkg_resources.parse_version('2.13'):
25
self.ec2.new_http_connection(host or self.host, 8773,
26
is_secure).AndReturn(self.http)
27
- elif boto.Version >= '2':
28
+ elif boto_version >= pkg_resources.parse_version('2'):
29
self.ec2.new_http_connection(host or '%s:8773' % (self.host),
30
is_secure).AndReturn(self.http)