def wrapped_f(*args, **kwargs): checksums = {path: path_hash(path) for path in restart_map} f(*args, **kwargs) restarts = [] for path in restart_map: if path_hash(path) != checksums[path]: restarts += restart_map[path] services_list = list(OrderedDict.fromkeys(restarts)) status_set('maintenance', 'Random wait for restart to avoid collisions') time.sleep(random.random() * 100) if not stopstart: for svc_name in services_list: system_service('restart', svc_name) wait_app() else: for action in ['stop', 'start']: for svc_name in services_list: system_service(action, svc_name) wait_app()
def wrapped_f(*args, **kwargs): if is_unit_paused_set(): return f(*args, **kwargs) checksums = {path: path_hash(path) for path in restart_map} f(*args, **kwargs) restarts = [] for path in restart_map: if path_hash(path) != checksums[path]: restarts += restart_map[path] services_list = list(OrderedDict.fromkeys(restarts)) cluster_wait() if not stopstart: for svc_name in services_list: system_service('restart', svc_name) wait_app() else: for action in ['stop', 'start']: for svc_name in services_list: system_service(action, svc_name) wait_app()
def wrapped_f(*args, **kwargs): if is_unit_paused_set(): return f(*args, **kwargs) checksums = {path: path_hash(path) for path in restart_map} f(*args, **kwargs) restarts = [] for path in restart_map: if path_hash(path) != checksums[path]: restarts += restart_map[path] services_list = list(OrderedDict.fromkeys(restarts)) status_set('maintenance', 'Random wait for restart to avoid collisions') time.sleep(random.random() * 100) if not stopstart: for svc_name in services_list: system_service('restart', svc_name) wait_app() else: for action in ['stop', 'start']: for svc_name in services_list: system_service(action, svc_name) wait_app()