You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2019/10/12 19:48:26 UTC
[libcloud] 01/05: adding a sync/async flag for destroy_node
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 7e85f4aa1903aca4c76e903eae253eb8878611c9
Author: Rob Zimmerman <ro...@datarobot.com>
AuthorDate: Wed Oct 9 15:35:15 2019 -0400
adding a sync/async flag for destroy_node
---
libcloud/compute/drivers/gce.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 889fd88..f2e9fd6 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -6816,7 +6816,7 @@ class GCENodeDriver(NodeDriver):
self.connection.async_request(request, method='DELETE')
return True
- def destroy_node(self, node, destroy_boot_disk=False):
+ def destroy_node(self, node, destroy_boot_disk=False, sync=True):
"""
Destroy a node.
@@ -6829,12 +6829,19 @@ class GCENodeDriver(NodeDriver):
method.)
:type destroy_boot_disk: ``bool``
+ :keyword sync: If true, do not return until destroyed or timeout
+ :type sync: ``bool``
+
:return: True if successful
:rtype: ``bool``
"""
request = '/zones/%s/instances/%s' % (node.extra['zone'].name,
node.name)
- self.connection.async_request(request, method='DELETE')
+ if sync:
+ self.connection.async_request(request, method='DELETE')
+ else:
+ self.connection.request(request, method='DELETE')
+
if destroy_boot_disk and node.extra['boot_disk']:
node.extra['boot_disk'].destroy()
return True