本文整理汇总了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.')
示例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')