finally fixed!
This commit is contained in:
		| @ -95,6 +95,7 @@ def restart_services(): | ||||
|     for proc in service_procs: | ||||
|         try: | ||||
|             service_exe = proc.exe() | ||||
|             proc_name = proc.name() | ||||
|         except (psutil.NoSuchProcess, psutil.ZombieProcess, psutil.AccessDenied): | ||||
|             log.debug('{} died before it could be restarted'.format(proc)) | ||||
|             continue | ||||
| @ -115,7 +116,6 @@ def restart_services(): | ||||
|         elif policy == 'warn': | ||||
|             log.warning('Service "{}" has open deleted files and should be restarted'.format(service)) | ||||
|             continue | ||||
|  | ||||
|         if not policy.startswith('silent'): | ||||
|             log.warning('Restarting service {}'.format(service)) | ||||
|         platform.restart_service(service) | ||||
| @ -123,15 +123,13 @@ def restart_services(): | ||||
|     recommend_restart = False | ||||
|     tested_parents = set() | ||||
|     for proc in retest_procs: | ||||
|         try: | ||||
|             name = proc.name() | ||||
|         except (psutil.NoSuchProcess, psutil.ZombieProcess, psutil.AccessDenied): | ||||
|             log.debug('{} was successfully killed'.format(proc)) | ||||
|             continue | ||||
|         parent = _get_top_parent(proc) | ||||
|         parent_name = parent.name() | ||||
|         if parent in tested_parents: | ||||
|             log.debug('{} belongs to already tested parent {}'.format(proc, parent)) | ||||
|             continue | ||||
|         if not parent: | ||||
|             continue | ||||
|  | ||||
|         if _get_deleted_open_files(proc): | ||||
|             tested_parents.add(parent) | ||||
| @ -141,12 +139,14 @@ def restart_services(): | ||||
|                 recommend_restart = True | ||||
|                 continue | ||||
|  | ||||
|             if service in services and not services[service]: | ||||
|             log.debug('{} is in service {}'.format(proc, service)) | ||||
|             if parent_name in services and not services[parent_name]: | ||||
|                 log.warning('{} (parent {}) does not belong to a service and could not be restarted'.format(proc, parent)) | ||||
|                 recommend_restart = True | ||||
|                 continue | ||||
|             elif service in services: | ||||
|             elif parent_name in services: | ||||
|                 policy = _get_service_restart_policy(service) | ||||
|                 log.debug('service {} has policy {}'.format(service, policy)) | ||||
|                 if policy in ('ignore', 'warn'): | ||||
|                     continue | ||||
|             log.warning('{} (parent {}) still has deleted files open'.format(proc, parent)) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user