Edit File: lve_control_hook.cpython-37.pyc
B 5/9e� � @ sT d dl mZ d dl mZ d dlZd dlZd dlmZ d dlmZ G dd� de�Z dS )� )�print_function)�absolute_importN)�ModifyUserHook)�lve_supported_or_exitc @ s8 e Zd ZdZdZedd� �Zedd� �Zedd� �Z d S ) �LveLifecycleHookzM Apply limits on user creation and remove limits on user destroy z/usr/sbin/lvectlc C s t �| j|t|�g�S )z� This function doesn't return! Should be last call in code :param cmd: apply|destroy :param uid: lve id )� subprocessZcall�LVECTL�str)�cls�cmd�uid� r �&py/lve_utils/hooks/lve_control_hook.py�exec_lvectl_cmd s z LveLifecycleHook.exec_lvectl_cmdc K s t �|�j}| �d|� d S )NZapply)�pwd�getpwnam�pw_uidr )�self�username�owner�kwargsr r r r �post_create_user! s z!LveLifecycleHook.post_create_userc K s( t �|�j}| �d|� | �d|� d S )N�deleteZdestroy)r r r r )r r r r r r r �pre_delete_user'