def restart_on_change(restart_map, func):
"""Restart services using provided function based
on configuration files changing"""
def wrap(f):
def wrapped_f(*args):
checksums = {}
for path in restart_map:
checksums[path] = file_hash(path)
f(*args)
restarts = []
for path in restart_map:
if checksums[path] != file_hash(path):
restarts += restart_map[path]
services_list = list(OrderedDict.fromkeys(restarts))
for s_name in services_list:
func(s_name)
return wrapped_f
return wrap
nova_compute_proxy.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录