Revision cd577680 lib/rapi/client.py
b/lib/rapi/client.py | ||
---|---|---|
490 | 490 |
if dry_run: |
491 | 491 |
query.append(("dry-run", 1)) |
492 | 492 |
|
493 |
self._SendRequest(HTTP_DELETE, "/2/tags", query) |
|
493 |
return self._SendRequest(HTTP_DELETE, "/2/tags", query)
|
|
494 | 494 |
|
495 | 495 |
def GetInstances(self, bulk=False): |
496 | 496 |
"""Gets information about instances on the cluster. |
... | ... | |
512 | 512 |
else: |
513 | 513 |
return [i["id"] for i in instances] |
514 | 514 |
|
515 |
|
|
516 | 515 |
def GetInstanceInfo(self, instance): |
517 | 516 |
"""Gets information about an instance. |
518 | 517 |
|
... | ... | |
605 | 604 |
if dry_run: |
606 | 605 |
query.append(("dry-run", 1)) |
607 | 606 |
|
608 |
self._SendRequest(HTTP_DELETE, "/2/instances/%s/tags" % instance, query) |
|
607 |
return self._SendRequest(HTTP_DELETE, "/2/instances/%s/tags" % instance, |
|
608 |
query) |
|
609 | 609 |
|
610 | 610 |
def RebootInstance(self, instance, reboot_type=None, ignore_secondaries=None, |
611 | 611 |
dry_run=False): |
... | ... | |
630 | 630 |
if dry_run: |
631 | 631 |
query.append(("dry-run", 1)) |
632 | 632 |
|
633 |
self._SendRequest(HTTP_POST, "/2/instances/%s/reboot" % instance, query) |
|
633 |
return self._SendRequest(HTTP_POST, "/2/instances/%s/reboot" % instance, |
|
634 |
query) |
|
634 | 635 |
|
635 | 636 |
def ShutdownInstance(self, instance, dry_run=False): |
636 | 637 |
"""Shuts down an instance. |
... | ... | |
645 | 646 |
if dry_run: |
646 | 647 |
query.append(("dry-run", 1)) |
647 | 648 |
|
648 |
self._SendRequest(HTTP_PUT, "/2/instances/%s/shutdown" % instance, query) |
|
649 |
return self._SendRequest(HTTP_PUT, "/2/instances/%s/shutdown" % instance, |
|
650 |
query) |
|
649 | 651 |
|
650 | 652 |
def StartupInstance(self, instance, dry_run=False): |
651 | 653 |
"""Starts up an instance. |
... | ... | |
660 | 662 |
if dry_run: |
661 | 663 |
query.append(("dry-run", 1)) |
662 | 664 |
|
663 |
self._SendRequest(HTTP_PUT, "/2/instances/%s/startup" % instance, query) |
|
665 |
return self._SendRequest(HTTP_PUT, "/2/instances/%s/startup" % instance, |
|
666 |
query) |
|
664 | 667 |
|
665 | 668 |
def ReinstallInstance(self, instance, os, no_startup=False): |
666 | 669 |
"""Reinstalls an instance. |
... | ... | |
676 | 679 |
query = [("os", os)] |
677 | 680 |
if no_startup: |
678 | 681 |
query.append(("nostartup", 1)) |
679 |
self._SendRequest(HTTP_POST, "/2/instances/%s/reinstall" % instance, query) |
|
682 |
return self._SendRequest(HTTP_POST, "/2/instances/%s/reinstall" % instance, |
|
683 |
query) |
|
680 | 684 |
|
681 | 685 |
def ReplaceInstanceDisks(self, instance, disks, mode="replace_auto", |
682 | 686 |
remote_node=None, iallocator="hail", dry_run=False): |
... | ... | |
758 | 762 |
if dry_run: |
759 | 763 |
query.append(("dry-run", 1)) |
760 | 764 |
|
761 |
self._SendRequest(HTTP_DELETE, "/2/jobs/%d" % job_id, query) |
|
765 |
return self._SendRequest(HTTP_DELETE, "/2/jobs/%d" % job_id, query)
|
|
762 | 766 |
|
763 | 767 |
def GetNodes(self, bulk=False): |
764 | 768 |
"""Gets all nodes in the cluster. |
Also available in: Unified diff