本文整理汇总了Python中charmhelpers.core.host.service_restart方法的典型用法代码示例。如果您正苦于以下问题:Python host.service_restart方法的具体用法?Python host.service_restart怎么用?Python host.service_restart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charmhelpers.core.host
的用法示例。
在下文中一共展示了host.service_restart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reconfigure_services
# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import service_restart [as 别名]
def reconfigure_services(self, *service_names):
"""
Update all files for one or more registered services, and,
if ready, optionally restart them.
If no service names are given, reconfigures all registered services.
"""
for service_name in service_names or self.services.keys():
if self.is_ready(service_name):
self.fire_event('data_ready', service_name)
self.fire_event('start', service_name, default=[
service_restart,
manage_ports])
self.save_ready(service_name)
else:
if self.was_ready(service_name):
self.fire_event('data_lost', service_name)
self.fire_event('stop', service_name, default=[
manage_ports,
service_stop])
self.save_lost(service_name)