From cf9ada49c9fa7571212508e49a5b9fc9c2f3c0d6 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 7 May 2010 20:29:18 +0200
Subject: [PATCH] =?UTF-8?q?RAPI=20client:=20Rename=20=E2=80=9CDeleteJob?=
 =?UTF-8?q?=E2=80=9D=20to=20=E2=80=9CCancelJob=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Jobs can't be deleted, but cancelled (even though the HTTP method
β€œDELETE” is used).

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>
---
 lib/rapi/client.py                  | 4 ++--
 test/ganeti.rapi.client_unittest.py | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/rapi/client.py b/lib/rapi/client.py
index 813904917..aedf0b8c9 100644
--- a/lib/rapi/client.py
+++ b/lib/rapi/client.py
@@ -760,8 +760,8 @@ class GanetiRapiClient(object):
     """
     return self._SendRequest(HTTP_GET, "/2/jobs/%d" % job_id, None, None)
 
-  def DeleteJob(self, job_id, dry_run=False):
-    """Deletes a job.
+  def CancelJob(self, job_id, dry_run=False):
+    """Cancels a job.
 
     @type job_id: int
     @param job_id: id of the job to delete
diff --git a/test/ganeti.rapi.client_unittest.py b/test/ganeti.rapi.client_unittest.py
index 727dcbf5a..f7ceea6ae 100755
--- a/test/ganeti.rapi.client_unittest.py
+++ b/test/ganeti.rapi.client_unittest.py
@@ -324,10 +324,10 @@ class GanetiRapiClientTests(unittest.TestCase):
     self.assertHandler(rlib2.R_2_jobs_id)
     self.assertItems(["1234"])
 
-  def testDeleteJob(self):
+  def testCancelJob(self):
     self.rapi.AddResponse("[true, \"Job 123 will be canceled\"]")
     self.assertEqual([True, "Job 123 will be canceled"],
-                     self.client.DeleteJob(999, dry_run=True))
+                     self.client.CancelJob(999, dry_run=True))
     self.assertHandler(rlib2.R_2_jobs_id)
     self.assertItems(["999"])
     self.assertDryRun()
-- 
GitLab