HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/lib/python3.9/site-packages/ansible/utils/__pycache__/display.cpython-39.pyc
a

�)g�K�@s�ddlmZmZmZeZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlmZmZddlmZddlmZddlmZmZddlmZmZddl m!Z!dd	l"m#Z#dd
l$m%Z&ddl'm(Z(ddl)m*Z*dd
l+m,Z,ej-�.ej/�0d��Z1ej2fe1j3_4ej5ej6fe1j7_4de�8ej6�dddZ9dd�Z:Gdd�de
j;�Z<Gdd�de
j;�Z=dZ>e?ed��r,ej@ZAeA�r�ejA�BeA��r�e�CeAejD��s�e�CejA�EeA�ejD��re
jFeAe
jGdd�e
�Hd�Z>e
jIjJD](ZKeK�Le<e?edg���eK�Le=���q�neMdeAejNd�ejOe
jPejQe
jRejSe
jGejTe
jRejUe
jPejVe
jWejXe
jGejYe
jRejZe
jGi	Z[dZ\d d!�Z]Gd"d#�d#e(d$�Z^dS)%�)�absolute_import�division�print_functionN)�unpack�pack)�
TIOCGWINSZ)�	constants)�AnsibleError�AnsibleAssertionError)�to_bytes�to_text)�	text_type)�stringc)�context)�	Singleton)�wrap_var��wraps�c���c	Cs�t|t�stdt|���zt�|t�}WntjyBd}Yn0|dkrP|Sd}d}|D]b}|d7}|dvr�|d8}|d8}q\zt�	|�}Wntjy�d}Yn0|dkr�d}||7}q\|dkr�|r�t
d|��|dkr�|SdS)a3Function that utilizes ``wcswidth`` or ``wcwidth`` to determine the
    number of columns used to display a text string.

    We try first with ``wcswidth``, and fallback to iterating each
    character and using wcwidth individually, falling back to a value of 0
    for non-printable wide characters.
    z$get_text_width requires text, not %s���rr)���”�z3get_text_width could not calculate text width of %r)�
isinstancer
�	TypeError�type�_LIBC�wcswidth�_MAX_INT�ctypes�
ArgumentError�wcwidth�EnvironmentError)�text�widthZcounterr�w�r*�9/usr/lib/python3.9/site-packages/ansible/utils/display.py�get_text_width8s8



�r,c@seZdZdd�Zdd�ZdS)�FilterBlackListcCsdd�|D�|_dS)NcSsg|]}t�|��qSr*)�logging�Filter)�.0�namer*r*r+�
<listcomp>m�z,FilterBlackList.__init__.<locals>.<listcomp>)�	blacklist)�selfr4r*r*r+�__init__lszFilterBlackList.__init__cst�fdd�|jD��S)Nc3s|]}|���VqdS�N)�filter�r0�f��recordr*r+�	<genexpr>pr3z)FilterBlackList.filter.<locals>.<genexpr>)�anyr4�r5r<r*r;r+r8oszFilterBlackList.filterN)�__name__�
__module__�__qualname__r6r8r*r*r*r+r-ksr-c@sDeZdZdZze��ZWney6de�	�ZYn0dd�Z
dS)�FilterUserInjectorz�
    This is a filter which injects the current user as the 'user' attribute on each record. We need to add this filter
    to all logger handlers so that 3rd party libraries won't print an exception due to user not being defined.
    zuid=%scCstj|_dS)NT)rC�username�userr?r*r*r+r8szFilterUserInjector.filterN)r@rArB�__doc__�getpassZgetuserrD�KeyError�os�getuidr8r*r*r*r+rCssrC�DEFAULT_LOG_PATHz=%(asctime)s p=%(process)d u=%(user)s n=%(name)s | %(message)s)�filename�level�format�ansibleZDEFAULT_LOG_FILTERzM[WARNING]: log file at %s is not writeable and we cannot create it, aborting
)�file)s/usr/bin/cowsays/usr/games/cowsays/usr/local/bin/cowsays/opt/local/bin/cowsaycCs.dd�}|j}||j|�|_||j|�|_dS)Ncst����fdd��}|S)Ncs6���|i|��Wd�S1s(0YdSr7r*)�args�kwargs�r:�lockr*r+�locking_wrapper�szL_synchronize_textiowrapper.<locals>._wrap_with_lock.<locals>.locking_wrapperr)r:rTrUr*rSr+�_wrap_with_lock�sz3_synchronize_textiowrapper.<locals>._wrap_with_lock)�buffer�write�flush)ZtiorTrVrWr*r*r+�_synchronize_textiowrapper�srZc@s�eZdZd2dd�Zdd�Zdd�Zd3dd�Zd4d
d�Zd5dd�Zd6dd�Z	d7dd�Z
d8dd�Zd9dd�Zd:dd�Z
d;dd�Zd<dd�Zd=d d!�Zd>d"d#�Zd$d%�Zd?d&d'�Zd@d(d)�ZdAd*d+�ZedBd,d-��ZdCd.d/�Zd0d1�ZdS)D�Displayrc
Cs�d|_t��|_d|_||_i|_i|_i|_d|_	t
j|_|�
�|j	r�zltj|j	dgtjtjd�}|��\}}|jr|t�dd�|��D�|_t
jr�tt
j�r�tt
j��|j�|_Wnty�d|_	Yn0|��z ttj|j�ttj|j�Wn6t�y.}z|�d|���WYd}~n
d}~00z tjj dd�tjj dd�Wn6t�y�}z|�d	|���WYd}~n
d}~00dS)
Nz-l��stdout�stderrcSsh|]}t|��qSr*)r)r0rr*r*r+�	<setcomp>�r3z#Display.__init__.<locals>.<setcomp>Fz/failed to patch stdout/stderr for fork-safety: �replace��errorszDfailed to reconfigure stdout/stderr with the replace error handler: )!�_final_q�	threading�RLock�_lock�columns�	verbosity�
_deprecations�_warns�_errors�b_cowsay�CZANSIBLE_COW_SELECTION�noncow�set_cowsay_info�
subprocess�Popen�PIPE�communicate�
returncode�	Exception�split�cows_availableZANSIBLE_COW_ACCEPTLISTr>�set�intersection�_set_column_widthrZ�sysr]r^�warning�reconfigure)r5rh�cmd�out�err�exr*r*r+r6�s@
&zDisplay.__init__cCst��durtd��||_dS)z�Set the _final_q on Display, so that we know to proxy display over the queue
        instead of directly writing to stdout/stderr from forks

        This is only needed in ansible.executor.process.worker:WorkerProcess._run
        Nz%queue cannot be set in parent process)�multiprocessing_contextZparent_process�RuntimeErrorrc)r5Zqueuer*r*r+�	set_queue�szDisplay.set_queuecCs:tjr
dStjrtj|_ntD]}tj�|�r||_qdSr7)rmZANSIBLE_NOCOWSZANSIBLE_COW_PATHrl�b_COW_PATHSrI�path�exists)r5Z
b_cow_pathr*r*r+ro�s
zDisplay.set_cowsay_infoNFTcCs�|jr|jj||||||d�S|}|s�|�d�}|rB|dd�}	n|}	|rTt|	|�}	|s\|rd|	d}	|sptj}
ntj}
|j�|
�|	�Wd�n1s�0Yt	r�|s�|�
d�}	tj}|r�zt
|}Wnty�td|��Yn0t	�||	�dS)zy Display a message to the user

        Note: msg *must* be a unicode string to prevent UnicodeError tracebacks.
        )�colorr^�screen_only�log_only�newline�
Nrz%Invalid color supplied to display: %s)rcZsend_display�endswithrr{r]r^rfrX�logger�lstripr.�INFO�color_to_log_levelrHr
�log)r5�msgr�r^r�r�r�ZnocolorZhas_newlineZmsg2ZfileobjZlvlr*r*r+�displays8�

(
zDisplay.displaycCs|j||dd�S)Nr��host�caplevel��verbose�r5r�r�r*r*r+�vDsz	Display.vcCs|j||dd�S)Nrr�r�r�r*r*r+�vvGsz
Display.vvcCs|j||dd�S)Nrr�r�r�r*r*r+�vvvJszDisplay.vvvcCs|j||dd�S)N�r�r�r�r*r*r+�vvvvMszDisplay.vvvvcCs|j||dd�S)N�r�r�r�r*r*r+�vvvvvPsz
Display.vvvvvcCs|j||dd�S)N�r�r�r�r*r*r+�vvvvvvSszDisplay.vvvvvvcCsZtjrV|dur2|jdt��t��|ftjd�n$|jdt��t��||ftjd�dS)Nz
%6d %0.5f: %s�r�z%6d %0.5f [%s]: %s)rmZ
DEFAULT_DEBUGr�rI�getpid�time�COLOR_DEBUGr�r*r*r+�debugVs$z
Display.debugrcCsJtj}|j|krF|dur,|j|tj|d�n|jd||ftj|d�dS)N�r�r^z<%s> %s)rmZVERBOSE_TO_STDERRrhr��
COLOR_VERBOSE)r5r�r�r�Z	to_stderrr*r*r+r�]s

zDisplay.verbosecCs�|��}|r |ddvr |d7}|dkr,d}|rDd�|�}d}d}nd	�|�}d
}d}|rfd�|�}	nd
}	|rzd�|�}
n|r�d�|�}
nd}
d�dd�|||	|
|fD��}|S)z) used to print out a deprecation message.r)�!�?�.r�zansible.builtinzansible-corez[DEPRECATED]: {0}zThis feature was removedzPlease update your playbooks.z[DEPRECATION WARNING]: {0}zThis feature will be removedzZDeprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.zfrom {0}�zin a release after {0}.zin version {0}.zin a future release.� css|]}|r|VqdSr7r*r9r*r*r+r=�r3z2Display.get_deprecation_message.<locals>.<genexpr>)�striprN�join)r5r��version�removed�date�collection_name�headerZremoval_fragment�	help_textZ
from_fragmentZwhen�message_textr*r*r+�get_deprecation_messagefs,

zDisplay.get_deprecation_messagecCs||stjsdS|j|||||d�}|r.t|��tj||jdd�}d�|�d}||jvrx|j	|�
�tjdd�d|j|<dS)N)r�r�r�r�F)Zdrop_whitespacer�Tr�r)rmZDEPRECATION_WARNINGSr�r	�textwrap�wraprgr�rir�r��COLOR_DEPRECATE)r5r�r�r�r�r�r��wrappedr*r*r+�
deprecated�s

zDisplay.deprecatedcCs\|s*d|}t�||j�}d�|�d}nd|}||jvrX|j|tjdd�d|j|<dS)Nz
[WARNING]: %sr�z
[WARNING]: 
%sTr�r)r�r�rgr�rjr�rm�
COLOR_WARN)r5r��	formatted�new_msgr�r*r*r+r|�s
zDisplay.warningcCstjr|�|�dSr7)rmZSYSTEM_WARNINGSr|)r5r�r*r*r+�system_warning�szDisplay.system_warningcCs�t|�}|jr@|r@z|�|�WdSty>|�d�Yn0|��}z|jt|�}Wn tyz|jt	|�}Yn0|dkr�d}d|}|j
d||f|d�dS)zw
        Prints a header-looking line with cowsay or stars with length depending on terminal width (3 minimum)
        NzFsomebody cleverly deleted cowsay or something during the PB run.  heh.r��*z
%s %sr�)rrl�
banner_cowsay�OSErrorr|r�rgr,r&�lenr�)r5r�r�ZcowsZstar_lenZstarsr*r*r+�banner�s 

zDisplay.bannercCs�d|vr*|�dd�}|�d�r*|dd�}|jddg}|jrr|j}|dkrZt�t|j��}|�d	�|�t	|��|�t	|��t
j|t
jt
jd
�}|�
�\}}|jdt|�|d�dS)
Nz: [�[r��]rs-Ws60�randoms-fr\z%s
r�)r`r�rlrnr��choice�listrw�appendrrprqrrrsr�r)r5r�r�ZruncmdZthecowr~rr�r*r*r+r��s

zDisplay.banner_cowsaycCs\|r*d|}t�||j�}d�|�d}nd|}||jvrX|j|tjdd�d|j|<dS)Nz
[ERROR]: %sr�z	ERROR! %sTr�r)r�r�rgr�rkr�rm�COLOR_ERROR)r5r�Z	wrap_textr�r�r*r*r+�error�s
z
Display.errorcCs|rt�|�St|�SdSr7)rG�input)r��privater*r*r+�prompt�s
zDisplay.promptc
Cs�d}
tj��r�|j}|r.|dur.d||f}n|r<d|}nd|}|rx|||�}
|d||�}
|
|
krjq�|�d�qHq�|||�}
nd}
|�d�|
s�|dur�|}
|r�ddlm}||
|||�}
t|
d	d
�}
|	r�t	|
�}
|
S)Nz	%s [%s]: z%s: zinput for %s: zconfirm z&***** VALUES ENTERED DO NOT MATCH ****z/Not prompting as we are not in interactive moder)�
do_encryptZsurrogate_or_strictra)
r{�	__stdin__�isattyr�r�r|Zansible.utils.encryptr�rr)r5Zvarnamer�r�ZencryptZconfirmZ	salt_sizeZsalt�defaultZunsafe�resultZ	do_promptr��secondr�r*r*r+�
do_var_prompt�s4



zDisplay.do_var_promptcCsHt�d�r0tdt�dttddddd���d}nd}td|d�|_dS)NrZHHHHr�O)	rIr�r�fcntlZioctlrr�maxrg)r5Ztty_sizer*r*r+rzs
&zDisplay._set_column_width)r)NFFFT)N)N)N)N)N)N)N)Nr)NFNN)NFNN)F)NT)N)T)F)TNNFNNNN)r@rArBr6r�ror�r�r�r�r�r�r�r�r�r�r�r|r�r�r�r��staticmethodr�r�rzr*r*r*r+r[�s.
1

B







	
#






+r[)�	metaclass)_Z
__future__rrrrZ
__metaclass__Zctypes.utilr#r�rGr.rIr�rpr{r�rdr��structrrZtermiosrrOrrmZansible.errorsr	r
Zansible.module_utils._textrrZansible.module_utils.sixr
Zansible.utils.colorrZansible.utils.multiprocessingrr�Zansible.utils.singletonrZansible.utils.unsafe_proxyr�	functoolsrZcdllZLoadLibrary�utilZfind_libraryr Zc_wcharr%�argtypesZ	c_wchar_pZc_intr!Zsizeofr"r,r/r-rCr��getattrrKr�r��access�W_OK�dirnameZbasicConfigr�Z	getLogger�root�handlersZhandlerZ	addFilter�printr^r�ZERRORr�ZWARNINGZCOLOR_OKZ
COLOR_SKIPZCOLOR_UNREACHABLEr��DEBUGZ
COLOR_CHANGEDr�r�r�r�rZr[r*r*r*r+�<module>sn3<
�
�