~zulcss/nova/ftbfs-jan1

« back to all changes in this revision

Viewing changes to debian/patches/fix-boto-versioning.patch

  • Committer: James Page
  • Date: 2013-10-13 10:53:16 UTC
  • mfrom: (626.2.2 nova)
  • Revision ID: james.page@canonical.com-20131013105316-yz3mezj0jdzrxxxo
Tags: 1:2013.2~rc2-0ubuntu1
releasing package nova version 1:2013.2~rc2-0ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
4
 the tuples
 
5
Origin: https://review.openstack.org/#/c/51426/
 
6
Bug: https://bugs.launchpad.net/nova/+bug/1239220
 
7
 
 
8
--- a/nova/tests/api/ec2/test_api.py
 
9
+++ b/nova/tests/api/ec2/test_api.py
 
10
@@ -18,6 +18,7 @@
 
11
 
 
12
 """Unit tests for the API endpoint."""
 
13
 
 
14
+import pkg_resources
 
15
 import random
 
16
 import re
 
17
 import StringIO
 
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)
 
31
         else: