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


Python ServiceStateManager.remove_service_state方法代码示例

本文整理汇总了Python中juju.state.service.ServiceStateManager.remove_service_state方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceStateManager.remove_service_state方法的具体用法?Python ServiceStateManager.remove_service_state怎么用?Python ServiceStateManager.remove_service_state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在juju.state.service.ServiceStateManager的用法示例。


在下文中一共展示了ServiceStateManager.remove_service_state方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: destroy_service

# 需要导入模块: from juju.state.service import ServiceStateManager [as 别名]
# 或者: from juju.state.service.ServiceStateManager import remove_service_state [as 别名]
def destroy_service(config, environment, verbose, log, service_name):
    provider = environment.get_machine_provider()
    client = yield provider.connect()
    service_manager = ServiceStateManager(client)
    service_state = yield service_manager.get_service_state(service_name)
    yield service_manager.remove_service_state(service_state)
    log.info("Service %r destroyed.", service_state.service_name)
开发者ID:mcclurmc,项目名称:juju,代码行数:9,代码来源:destroy_service.py

示例2: destroy_service

# 需要导入模块: from juju.state.service import ServiceStateManager [as 别名]
# 或者: from juju.state.service.ServiceStateManager import remove_service_state [as 别名]
def destroy_service(config, environment, verbose, log, service_name):
    provider = environment.get_machine_provider()
    client = yield provider.connect()
    service_manager = ServiceStateManager(client)
    service_state = yield service_manager.get_service_state(service_name)
    if (yield service_state.is_subordinate()):
        # We can destroy the service if does not have relations.
        # That implies that principals have already been torn
        # down (or were never added).
        relation_manager = RelationStateManager(client)
        relations = yield relation_manager.get_relations_for_service(
            service_state)

        if relations:
            principal_service = None
            # if we have a container we can destroy the subordinate
            # (revisit in the future)
            for relation in relations:
                if relation.relation_scope != "container":
                    continue
                services = yield relation.get_service_states()
                remote_service = [s for s in services if s.service_name !=
                                     service_state.service_name][0]
                if not (yield remote_service.is_subordinate()):
                    principal_service = remote_service
                    break

            if principal_service:
                raise UnsupportedSubordinateServiceRemoval(
                    service_state.service_name,
                    principal_service.service_name)

    yield service_manager.remove_service_state(service_state)
    log.info("Service %r destroyed.", service_state.service_name)
开发者ID:anbangr,项目名称:trusted-juju,代码行数:36,代码来源:destroy_service.py


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