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: //proc/self/root/usr/lib/python3.9/site-packages/ansible/utils/__pycache__/path.cpython-39.pyc
a

�)g��@s�ddlmZmZmZeZddlZddlZddlm	Z	ddl
mZddlm
Z
mZmZddgZdd	d�Zdd
d�Zdd�Zddd�Zddd�ZdS)�)�absolute_import�division�print_functionN)�EEXIST)�AnsibleError)�to_bytes�	to_native�to_text�unfrackpath�
makedirs_safeTcCs�t|ddd�}|dur(tt��dd�}ntj�|�r@tj�|�}tj�tj�t|dd���}tj�|�svtj�	||�}|r�tj�
|�}ttj�|�dd�S)a�
    Returns a path that is free of symlinks (if follow=True), environment variables, relative path traversals and symbols (~)

    :arg path: A byte or text string representing a path to be canonicalized
    :arg follow: A boolean to indicate of symlinks should be resolved or not
    :raises UnicodeDecodeError: If the canonicalized version of the path
        contains non-utf8 byte sequences.
    :rtype: A text string (unicode on pyyhon2, str on python3).
    :returns: An absolute path with symlinks, environment variables, and tilde
        expanded.  Note that this does not check whether a path exists.

    example::
        '$HOME/../../var/mail' becomes '/var/spool/mail'
    �surrogate_or_strictZpassthru)�errorsZ	nonstringN�r
)
r�os�getcwd�path�isfile�dirname�
expanduser�
expandvars�isabs�join�realpathr	�normpath)r�follow�basedirZ	b_basedirZb_final_path�r�6/usr/lib/python3.9/site-packages/ansible/utils/path.pyr
sc
Cs�t|�}t|�}tj�|�s�z |r0t�||�n
t�|�WnFty�}z.|jtkrnt	dt
|�t
|�f��WYd}~n
d}~00dS)a�
    A *potentially insecure* way to ensure the existence of a directory chain. The "safe" in this function's name
    refers only to its ability to ignore `EEXIST` in the case of multiple callers operating on the same part of
    the directory chain. This function is not safe to use under world-writable locations when the first level of the
    path to be created contains a predictable component. Always create a randomly-named element first if there is any
    chance the parent directory might be world-writable (eg, /tmp) to prevent symlink hijacking and potential
    disclosure or modification of sensitive file contents.

    :arg path: A byte or text string representing a directory chain to be created
    :kwarg mode: If given, the mode to set the directory to
    :raises AnsibleError: If the directory cannot be created and does not already exist.
    :raises UnicodeDecodeError: if the path is not decodable in the utf-8 encoding.
    z*Unable to create local directories(%s): %sN)r
rrr�exists�makedirs�OSError�errnorrr)r�modeZrpathZb_rpath�errrrAs
cCsht|dd�}d}tj�|�r"|}n*|dvr4t��}ntj�|�rLtj�|�}|r\tj�|�}t|dd�S)z- returns directory for inventory or playbook rrN)N��.)	rrr�isdirrrr�abspathr	)�sourceZdnamerrrr]s
rFc
Cs�z�tj�|�r�z2tj�|�r(t�|�ntj�|�r>t�|�WnNty�}z6|rzddl	m
}|�}|�d�t
|���WYd}~n
d}~00Wnty�Yn0dS)a
    Removes temporary file or directory. Optionally display a warning if unable
    to remove the file or directory.

    :arg path: Path to file or directory to be removed
    :kwarg warn: Whether or not to display a warning when the file or directory
        cannot be removed
    r)�Displayz#Unable to remove temporary file {0}N)rrrr&�shutil�rmtreer�unlink�	ExceptionZansible.utils.displayr)�display�formatr	)r�warnr#r)r.rrr�cleanup_tmp_fileos	.r1cCs�d}t|dd�}t|dd�}|r8tj�|�}tj�|�}|�tjj�}|�tjj�}z|dt|��|k}Wnty~Yn0|S)z�
    Compares paths to check if one is contained in the other
    :arg: child: Path to test
    :arg parent; Path to test against
     F)rN)r
rrr�split�sep�len�
IndexError)�child�parent�real�testZ	abs_childZ
abs_parent�c�prrr�
is_subpath�sr<)TN)N)F)F)Z
__future__rrr�typeZ
__metaclass__rr*r!rZansible.errorsrZansible.module_utils._textrrr	�__all__r
rrr1r<rrrr�<module>s
"