Use len instead of for loop to get the end index

Bug #1282084 reported by Wu Wenxiang on 2014-02-19
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Wu Wenxiang

Bug Description

diff --git a/cinder/tests/ b/cinder/tests/
index 37d528f..2548cbd 100644
--- a/cinder/tests/
+++ b/cinder/tests/
@@ -109,8 +109,7 @@ class TSMBackupSimulator:
             ret_msg += ('Total number of objects deleted: 1\n'
                         'Total number of objects failed: 0')
             retcode = 0
- for idx, backup in enumerate(self._backup_list[path]):
- index = idx
+ index = len(self._backup_list[path]) - 1
             del self._backup_list[path][index]
             if not len(self._backup_list[path]):
                 del self._backup_list[path]

Fix proposed to branch: master

Changed in cinder:
assignee: nobody → Wu Wenxiang (wu-wenxiang)
status: New → In Progress

Submitter: Jenkins
Branch: master

commit 38e192afecd0d08921d4fb4d7166fa156addb6a4
Author: Wu Wenxiang <>
Date: Wed Feb 19 21:39:41 2014 +0800

    Use len instead of for-loop to get the end index

    Use len() instead of for-loop to get the end index in file

    Change-Id: I3a7b0e418f8af4881e21eb5273a03dbcd317c27d
    Closes-Bug: #1282084

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2014-03-05
Changed in cinder:
milestone: none → icehouse-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2014-04-17
Changed in cinder:
milestone: icehouse-3 → 2014.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers