EVOLUTION-NINJA
Edit File: process_manager.cpython-36.pyc
3 q��ih � @ s$ d dl Z d dlZG dd� de�ZdS )� Nc @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�ProcessManagerc s � �fdd�|D �}|S )zE Return only the pids belonging to certain username. c s2 g | ]*}t jjd | �r� jd | ��kr|�qS )z/proc/%s)�os�path�isdir�get_owner_name)�.0�pid)�self�username� �,/usr/lib/fm-agent/library/process_manager.py� <listcomp> s z8ProcessManager.get_process_from_user.<locals>.<listcomp>r )r �pidsr Z filtered_pidsr )r r r �get_process_from_user s z$ProcessManager.get_process_from_userc C s2 yt jtj|�j�d S tjk r, dS X dS )z: Return the owner name of the passed pid. r N)�pwd�getpwuidr �stat�st_uid�error)r r r r r r s zProcessManager.get_owner_namec C s t ttj|��S )zo Filter non pid process from the list, by checking that they are castable to integers. )�list�filter�str�isdigit)r Zprocess_listr r r �filter_non_pid_process s z%ProcessManager.filter_non_pid_processN)�__name__� __module__�__qualname__r r r r r r r r s r )r r �objectr r r r r �<module> s