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


Python Compose.kill方法代码示例

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


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

示例1: stop_scope

# 需要导入模块: from charms.docker.compose import Compose [as 别名]
# 或者: from charms.docker.compose.Compose import kill [as 别名]
def stop_scope():
    compose = Compose('files/scope')
    compose.kill()
    compose.rm()
    hookenv.close_port(4040)
    reactive.remove_state('scope.started')
    hookenv.status_set('maintenance', 'Weave stopped.')
开发者ID:juju-solutions,项目名称:layer-scope,代码行数:9,代码来源:weave.py

示例2: config_changed

# 需要导入模块: from charms.docker.compose import Compose [as 别名]
# 或者: from charms.docker.compose.Compose import kill [as 别名]
def config_changed():
    '''If the configuration values change, remove the available states.'''
    config = hookenv.config()
    if any(config.changed(key) for key in config.keys()):
        hookenv.log('The configuration options have changed.')
        # Use the Compose class that encapsulates the docker-compose commands.
        compose = Compose('files/kubernetes')
        if is_leader():
            hookenv.log('Removing master container and kubelet.available state.')  # noqa
            # Stop and remove the Kubernetes kubelet container.
            compose.kill('master')
            compose.rm('master')
            compose.kill('proxy')
            compose.rm('proxy')
            # Remove the state so the code can react to restarting kubelet.
            remove_state('kubelet.available')
        else:
            hookenv.log('Removing kubelet container and kubelet.available state.')  # noqa
            # Stop and remove the Kubernetes kubelet container.
            compose.kill('kubelet')
            compose.rm('kubelet')
            # Remove the state so the code can react to restarting kubelet.
            remove_state('kubelet.available')
            hookenv.log('Removing proxy container and proxy.available state.')
            # Stop and remove the Kubernetes proxy container.
            compose.kill('proxy')
            compose.rm('proxy')
            # Remove the state so the code can react to restarting proxy.
            remove_state('proxy.available')

    if config.changed('version'):
        hookenv.log('The version changed removing the states so the new '
                    'version of kubectl will be downloaded.')
        remove_state('kubectl.downloaded')
        remove_state('kubeconfig.created')
开发者ID:mbruzek,项目名称:layer-k8s,代码行数:37,代码来源:k8s.py


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