Revision cab667cc

b/lib/rapi/client.py
137 137
    @param query: query arguments to pass to urllib.urlencode
138 138
    @type prepend_version: bool
139 139
    @param prepend_version: whether to automatically fetch and prepend the
140
        Ganeti version to the URL path
140
        Ganeti RAPI version to the URL path
141 141

  
142 142
    @rtype:  str
143 143
    @return: URL path
......
171 171
    @param content: HTTP body content
172 172
    @type prepend_version: bool
173 173
    @param prepend_version: whether to automatically fetch and prepend the
174
        Ganeti version to the URL path
174
        Ganeti RAPI version to the URL path
175 175

  
176 176
    @rtype: str
177 177
    @return: JSON-Decoded response
......
213 213
    return self._version
214 214

  
215 215
  def GetVersion(self):
216
    """Gets the ganeti version running on the cluster.
216
    """Gets the Remote API version running on the cluster.
217 217

  
218 218
    @rtype: int
219 219
    @return: Ganeti version
......
266 266
    if dry_run:
267 267
      query.append(("dry-run", 1))
268 268

  
269
    self._SendRequest(HTTP_PUT, "/tags", query)
269
    return self._SendRequest(HTTP_PUT, "/tags", query)
270 270

  
271 271
  def DeleteClusterTags(self, tags, dry_run=False):
272 272
    """Deletes tags from the cluster.
......
339 339
    @type instance: str
340 340
    @param instance: the instance to delete
341 341

  
342
    @rtype: int
343
    @return: job id
344

  
342 345
    """
343 346
    query = []
344 347
    if dry_run:
345 348
      query.append(("dry-run", 1))
346 349

  
347
    self._SendRequest(HTTP_DELETE, "/instances/%s" % instance, query)
350
    return self._SendRequest(HTTP_DELETE, "/instances/%s" % instance, query)
348 351

  
349 352
  def GetInstanceTags(self, instance):
350 353
    """Gets tags for an instance.
......
376 379
    if dry_run:
377 380
      query.append(("dry-run", 1))
378 381

  
379
    self._SendRequest(HTTP_PUT, "/instances/%s/tags" % instance, query)
382
    return self._SendRequest(HTTP_PUT, "/instances/%s/tags" % instance, query)
380 383

  
381 384
  def DeleteInstanceTags(self, instance, tags, dry_run=False):
382 385
    """Deletes tags from an instance.
b/test/ganeti.rapi.client_unittest.py
192 192
    self.assertHandler(rlib2.R_2_tags)
193 193

  
194 194
  def testAddClusterTags(self):
195
    self.client.AddClusterTags(["awesome"], dry_run=True)
195
    self.rapi.AddResponse("1234")
196
    self.assertEqual(1234,
197
        self.client.AddClusterTags(["awesome"], dry_run=True))
196 198
    self.assertHandler(rlib2.R_2_tags)
197 199
    self.assertDryRun()
198 200
    self.assertQuery("tag", ["awesome"])
......
227 229
    self.assertDryRun()
228 230

  
229 231
  def testDeleteInstance(self):
230
    self.client.DeleteInstance("instance", dry_run=True)
232
    self.rapi.AddResponse("1234")
233
    self.assertEqual(1234, self.client.DeleteInstance("instance", dry_run=True))
231 234
    self.assertHandler(rlib2.R_2_instances_name)
232 235
    self.assertItems(["instance"])
233 236
    self.assertDryRun()
......
239 242
    self.assertItems(["fooinstance"])
240 243

  
241 244
  def testAddInstanceTags(self):
242
    self.client.AddInstanceTags("fooinstance", ["awesome"], dry_run=True)
245
    self.rapi.AddResponse("1234")
246
    self.assertEqual(1234,
247
        self.client.AddInstanceTags("fooinstance", ["awesome"], dry_run=True))
243 248
    self.assertHandler(rlib2.R_2_instances_name_tags)
244 249
    self.assertItems(["fooinstance"])
245 250
    self.assertDryRun()
......
425 430
    self.assertItems(["node-k"])
426 431

  
427 432
  def testAddNodeTags(self):
428
    self.client.AddNodeTags("node-v", ["awesome"], dry_run=True)
433
    self.rapi.AddResponse("1234")
434
    self.assertEqual(1234,
435
        self.client.AddNodeTags("node-v", ["awesome"], dry_run=True))
429 436
    self.assertHandler(rlib2.R_2_nodes_name_tags)
430 437
    self.assertItems(["node-v"])
431 438
    self.assertDryRun()

Also available in: Unified diff