From 03b63608af15a79d523ecea20de5b8ecc2d8b8df Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 20 Sep 2010 19:30:19 +0200
Subject: [PATCH] jqueue: Rename current_op to better reflect what it actually
 is

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/jqueue.py                  | 10 +++++-----
 test/ganeti.jqueue_unittest.py |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/jqueue.py b/lib/jqueue.py
index 0c276a977..4dd0b5364 100644
--- a/lib/jqueue.py
+++ b/lib/jqueue.py
@@ -176,7 +176,7 @@ class _QueuedJob(object):
 
   """
   # pylint: disable-msg=W0212
-  __slots__ = ["queue", "id", "ops", "log_serial", "current_op",
+  __slots__ = ["queue", "id", "ops", "log_serial", "ops_iter",
                "received_timestamp", "start_timestamp", "end_timestamp",
                "__weakref__"]
 
@@ -210,7 +210,7 @@ class _QueuedJob(object):
     """Initializes in-memory variables.
 
     """
-    obj.current_op = None
+    obj.ops_iter = None
 
   def __repr__(self):
     status = ["%s.%s" % (self.__class__.__module__, self.__class__.__name__),
@@ -766,13 +766,13 @@ class _JobProcessor(object):
     # lookups
     # TODO: Consider splitting _QueuedJob.ops into two separate lists, one for
     # pending and one for processed ops.
-    if job.current_op is None:
-      job.current_op = enumerate(job.ops)
+    if job.ops_iter is None:
+      job.ops_iter = enumerate(job.ops)
 
     # Find next opcode to run
     while True:
       try:
-        (idx, op) = job.current_op.next()
+        (idx, op) = job.ops_iter.next()
       except StopIteration:
         raise errors.ProgrammerError("Called for a finished job")
 
diff --git a/test/ganeti.jqueue_unittest.py b/test/ganeti.jqueue_unittest.py
index ce065411c..d573378c6 100755
--- a/test/ganeti.jqueue_unittest.py
+++ b/test/ganeti.jqueue_unittest.py
@@ -756,11 +756,11 @@ class TestJobProcessor(unittest.TestCase):
                         [constants.OP_STATUS_QUEUED
                          for _ in range(len(ops) - successcount)]])
 
-      self.assert_(job.current_op)
+      self.assert_(job.ops_iter)
 
       # Serialize and restore (simulates program restart)
       newjob = jqueue._QueuedJob.Restore(queue, job.Serialize())
-      self.assertFalse(newjob.current_op)
+      self.assertFalse(newjob.ops_iter)
       self._TestPartial(newjob, successcount)
 
   def _TestPartial(self, job, successcount):
-- 
GitLab