관리-도구
편집 파일: pause.cpython-39.opt-1.pyc
a �����)g:-������������������� ���@���sz��d�dl�mZmZmZ�eZd�dlZd�dlZd�dlZd�dl Z d�dl Z d�dlZd�dlm Z mZmZ�d�dlmZ�d�dlmZmZ�d�dlmZ�d�dlmZ�d�dlmZ�e��ZzFd�dlZd�dlZze����d ZW�n �ej e!ej"fy����d ZY�n0�W�n�e#y����d ZY�n0�dZ$dZ%e�r.e�&d ��pe$Z$e�&d��p,e%Z%e j'fdd�Z(G�dd��de)�Z*dd��Z+dd��Z,ddd�Z-G�dd��de�Z.dS�)�����)�absolute_import�division�print_functionN)�getpgrp�isatty� tcgetpgrp)�AnsibleError)�to_text� to_native)�boolean)� ActionBase)�DisplayTF���� s���[KZcr�elc�����������������C���s����t��|��}|tj�t�jt�jB�t�jB�t�jB�t�jB��@�|tj<�|tj �t�j t�jB��@�|tj <�|tj �t�jB�|tj <�|tj �t�jt�jB�t�jB�t�jB��@�|tj <�d|tj�t�j<�d|tj�t�j<�t��|�||��dS�)a��Put terminal into a raw mode. Copied from ``tty`` from CPython 3.11.0, and modified to not remove OPOST from OFLAG OPOST is kept to prevent an issue with multi line prompts from being corrupted now that display is proxied via the queue from forks. The problem is a race condition, in that we proxy the display over the fork, but before it can be displayed, this plugin will have continued executing, potentially setting stdout and stdin to raw which remove output post processing that commonly converts NL to CRLF ����r���N)�termios� tcgetattr�ttyZIFLAGZBRKINTZICRNLZINPCKZISTRIPZIXONZCFLAGZCSIZEZPARENBZCS8ZLFLAG�ECHOZICANONZIEXTENZISIGZCCZVMINZVTIME� tcsetattr)�fdZwhen�mode��r����@/usr/lib/python3.9/site-packages/ansible/plugins/action/pause.py�setraw=���s���� 0*r���c�������������������@���s���e�Zd�ZdS�)�AnsibleTimeoutExceededN)�__name__� __module__�__qualname__r���r���r���r���r���R���s���r���c�����������������C���s���t��d�S�)N)r���)Zsignum�framer���r���r����timeout_handlerV���s����r ���c�����������������C���s ���|���dt���|���dt���d�S�)Ns���[%s)�write�MOVE_TO_BOL�CLEAR_TO_EOL)�stdoutr���r���r���� clear_lineZ���s����r%���c�����������������C���s*���|�d�u�rdS�t�|��r"t��t|��kS�dS�d�S�)NF)r���r���r���)r���r���r���r����is_interactive_���s ����r&���c�����������������������s.���e�Zd�ZdZdZd��fdd� Zdd��Z���ZS�) �ActionModulezC pauses execution for a length or time, or until input is received TNc��������������������s4��|du�rt���}tt|���||�}~|�jddd�dtidtiddid�dd �\}}d }d}d}|d�} d} |�t�d dddddd| d���| s�d} |d�r�d|�j���� ��|d�| f�}nd|�j���� ��d| f�}|d �dur�|d �d�}n|d�dur�|d�}d}t � ��}ttj� ���|d<�d|d<�d}d} �zh�z�|du�r�|dk��rHd}t�tjt��t�|��t�d|| f���t�d�f�|d��r�t�|��n t�|��d}d}z&|�jjj}tjj}|���}|���}W�n�ttf�y����d}Y�n0�t|�}|�r�zt�|�d�tj�}W�n�t�y(���d}Y�n0�zt�|�d�tj �}W�n�t�y^���ddg}Y�n0�t�|�} t!|��t"|��r�t!|��|�s�| �r�t�|�}|d �tj#B�|d <�t�$|tj%|��t�&|tj'��|�s�|du��r�t�(d!��|du�r�t �)|d����q�z�|�*d�}||k�r"t+|��t,�|�s�|d"v��rBt+|��W��q�nT||v��r�|d�dd#��|d<�t+|��| �r||�-|d���|�.���n|d��|7��<�W�nT�t,�y����t�d��t�d$�f�|��/|��r�t+|��Y��q�t+|��t0d%��Y�n0��q�W�n�t1�y���Y�n0�W�d|| fv�r4t"|��r4t�$|tj2| ��t � ��|�}ttj� ���|d&<�t|�|d'<�|d k�rxt3|d(�d)�}n t3|d)�}d*||f�|d+<�n�d|| fv�r�t"|��r�t�$|tj2| ��t � ��|�}ttj� ���|d&<�t|�|d'<�|d k�r�t3|d(�d)�}n t3|d)�}d*||f�|d+<�0�t|d�d,d-�|d<�|S�).z run the pause action module N�boolT)�type�defaultr)����str)�echo�minutes�seconds�prompt))r-���r.���)Z argument_specZmutually_exclusiver-���r,�����Fr���)Zchanged�rc�stderrr$����start�stop�deltar,���z (output is hidden)r/���z [%s] %s%s:z,Press enter to continue, Ctrl+C to interrupt�<���r.���r3��������Z user_inputr���zPausing for %d seconds%sz<(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort) ��������������������z>Not waiting for response to prompt as stdin is not interactive)r������� ���z0Press 'C' to continue the play or 'A' to abort zuser requested abort!r4���r5���g������N@����zPaused for %s %sr$���Zsurrogate_or_strict)�errors)4�dict�superr'����runZvalidate_argument_spec�int�updateZ_taskZget_name�strip�timer ����datetimeZnow�signal�SIGALRMr ����alarm�displayZ_connectionZ _new_stdin�buffer�sysr$����fileno� ValueError�AttributeErrorr&���r���r���ZVINTR� ExceptionZVERASEr���r���r���r���ZTCSANOWZtcflushZTCIFLUSHZwarning�sleep�readr%����KeyboardInterruptr!����flush�_c_or_ar���r���Z TCSADRAIN�round)�self�tmpZ task_vars�resultZvalidation_resultZnew_module_argsZ duration_unitr/���r.���r,���Zecho_promptr3���Zstdin_fdZold_settingsZ stdout_fd�stdinr$����interactiveZintrZ backspaceZnew_settings�key_pressedZduration�� __class__r���r���rC���q���s ����� � � zActionModule.runc�����������������C���s0���|��d�}|���dkrdS�|���dkr�dS�q�d�S�)Nr�������aF����cT)rT����lower)rY���r\���r^���r���r���r���rW���1��s ���� zActionModule._c_or_a)NN)r���r���r����__doc__ZBYPASS_HOST_LOOPrC���rW���� __classcell__r���r���r_���r���r'���l���s ����Ar'���)N)/Z __future__r���r���r���r)���Z __metaclass__rH���rI���rN���r���rG���r����osr���r���r���Zansible.errorsr���Zansible.module_utils._textr ���r ���Z)ansible.module_utils.parsing.convert_boolr���Zansible.plugins.actionr���Zansible.utils.displayr ���rL���Zcurses�ioZ setuptermZ HAS_CURSES�error� TypeError�UnsupportedOperation�ImportErrorr"���r#���ZtigetstrZ TCSAFLUSHr���rR���r���r ���r%���r&���r'���r���r���r���r����<module>���sF���