]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Python 3 incompatible expression fix
authorSzymon Wroblewski <szymon.wroblewski@intel.com>
Thu, 20 Aug 2015 11:44:08 +0000 (13:44 +0200)
committerSzymon Wroblewski <szymon.wroblewski@intel.com>
Wed, 26 Aug 2015 15:13:26 +0000 (17:13 +0200)
In Python 3 dict.keys() return iterable view which
does not support indexing. This patch fixes the issue by using
appropriate iterator functions.

Implements: bp cinder-python3
Change-Id: Ib31531e5890fb050ce3c03ea0a078afd2122abe4

cinder/backup/manager.py

index b77b24a3117744a067efca8ec809b854c95570fe..4cbbf87c35c4d34da2fc7f8c22e8511c3ced4f76 100644 (file)
@@ -120,8 +120,8 @@ class BackupManager(manager.SchedulerDependentManager):
                  host)
 
         if 'default' not in self.volume_managers:
-            # For multi-backend we just pick the top of the list.
-            return self.volume_managers.keys()[0]
+            # For multi-backend we just pick "first" from volume managers dict
+            return next(iter(self.volume_managers))
 
         return 'default'