当前位置: 首页>>代码示例>>Python>>正文


Python Node.destroy方法代码示例

本文整理汇总了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)
开发者ID:andreioprisan,项目名称:mist.io,代码行数:34,代码来源:views.py

示例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)
开发者ID:Keisuke69,项目名称:libcloud,代码行数:10,代码来源:test_opsource.py

示例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
开发者ID:kevin-zhangsen,项目名称:badam,代码行数:12,代码来源:test_dimensiondata.py

示例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())
开发者ID:kevin-zhangsen,项目名称:badam,代码行数:9,代码来源:test_voxel.py

示例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)
开发者ID:IsCoolEntertainment,项目名称:debpkg_libcloud,代码行数:11,代码来源:test_slicehost.py

示例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)
开发者ID:BantouTelecom,项目名称:mist.io,代码行数:20,代码来源:views.py


注:本文中的libcloud.compute.base.Node.destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。