本文整理汇总了Python中libcloud.compute.base.Node.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python Node.destroy方法的具体用法?Python Node.destroy怎么用?Python Node.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libcloud.compute.base.Node
的用法示例。
在下文中一共展示了Node.destroy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: destroy_machine
# 需要导入模块: from libcloud.compute.base import Node [as 别名]
# 或者: from libcloud.compute.base.Node import destroy [as 别名]
def destroy_machine(request):
"""Destroys a machine on a certain backend.
After destroying a machine it also deletes all key associations. However,
it doesn't undeploy the keypair. There is no need to do it because the
machine will be destroyed.
"""
try:
conn = connect(request)
except:
return Response("Backend not found", 404)
machine_id = request.matchdict["machine"]
machine = Node(machine_id, name=machine_id, state=0, public_ips=[], private_ips=[], driver=conn)
machine.destroy()
backend_id = request.matchdict["backend"]
pair = [backend_id, machine_id]
try:
keypairs = request.environ["beaker.session"]["keypairs"]
except:
keypairs = request.registry.settings.get("keypairs", {})
for key in keypairs:
machines = keypairs[key].get("machines", None)
if pair in machines:
disassociate_key(request, key, backend_id, machine_id, undeploy=False)
return Response("Success", 200)
示例2: test_destroy_node_response_INPROGRESS
# 需要导入模块: from libcloud.compute.base import Node [as 别名]
# 或者: from libcloud.compute.base.Node import destroy [as 别名]
def test_destroy_node_response_INPROGRESS(self):
OpsourceMockHttp.type = "INPROGRESS"
node = Node(id="11", name=None, state=None, public_ips=None, private_ips=None, driver=self.driver)
try:
node.destroy()
self.assertTrue(False) # above command should have thrown OpsourceAPIException
except OpsourceAPIException:
self.assertTrue(True)
示例3: test_destroy_node_response_INPROGRESS
# 需要导入模块: from libcloud.compute.base import Node [as 别名]
# 或者: from libcloud.compute.base.Node import destroy [as 别名]
def test_destroy_node_response_INPROGRESS(self):
DimensionDataMockHttp.type = 'INPROGRESS'
node = Node(id='11', name=None, state=None,
public_ips=None, private_ips=None, driver=self.driver)
try:
node.destroy()
self.assertTrue(
False) # above command should have thrown DimensionDataAPIException
except DimensionDataAPIException:
pass
示例4: test_destroy_node
# 需要导入模块: from libcloud.compute.base import Node [as 别名]
# 或者: from libcloud.compute.base.Node import destroy [as 别名]
def test_destroy_node(self):
VoxelMockHttp.type = 'DESTROY_NODE'
node = Node(
id=72258, name=None, state=None, public_ips=None, private_ips=None,
driver=self.driver)
self.assertTrue(node.destroy())
示例5: test_destroy_node
# 需要导入模块: from libcloud.compute.base import Node [as 别名]
# 或者: from libcloud.compute.base.Node import destroy [as 别名]
def test_destroy_node(self):
node = Node(id=1, name=None, state=None, public_ips=None, private_ips=None,
driver=self.driver)
ret = node.destroy()
self.assertTrue(ret is True)
ret = self.driver.destroy_node(node)
self.assertTrue(ret is True)
示例6: destroy_machine
# 需要导入模块: from libcloud.compute.base import Node [as 别名]
# 或者: from libcloud.compute.base.Node import destroy [as 别名]
def destroy_machine(request):
"""Destroys a machine on a certain backend."""
try:
conn = connect(request)
except:
return Response('Backend not found', 404)
machine_id = request.matchdict['machine']
machine = Node(machine_id,
name=machine_id,
state=0,
public_ips=[],
private_ips=[],
driver=conn)
machine.destroy()
return Response('Success', 200)