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__/assemble.cpython-311.opt-1.pyc
�

���c#���ddlmZmZmZeZdZdZdZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZmZddlmZdd
�Zdd�Zd�Zed
kre��dSdS)�)�absolute_import�division�print_functiona\
---
module: assemble
short_description: Assemble configuration files from fragments
description:
- Assembles a configuration file from fragments.
- Often a particular program will take a single configuration file and does not support a
  C(conf.d) style structure where it is easy to build up the configuration
  from multiple sources. C(assemble) will take a directory of files that can be
  local or have already been transferred to the system, and concatenate them
  together to produce a destination file.
- Files are assembled in string sorting order.
- Puppet calls this idea I(fragments).
version_added: '0.5'
options:
  src:
    description:
    - An already existing directory full of source files.
    type: path
    required: true
  dest:
    description:
    - A file to create using the concatenation of all of the source files.
    type: path
    required: true
  backup:
    description:
    - Create a backup file (if C(true)), including the timestamp information so
      you can get the original file back if you somehow clobbered it
      incorrectly.
    type: bool
    default: no
  delimiter:
    description:
    - A delimiter to separate the file contents.
    type: str
    version_added: '1.4'
  remote_src:
    description:
    - If C(false), it will search for src at originating/master machine.
    - If C(true), it will go to the remote/target machine for the src.
    type: bool
    default: yes
    version_added: '1.4'
  regexp:
    description:
    - Assemble files only if C(regex) matches the filename.
    - If not set, all files are assembled.
    - Every C(\) (backslash) must be escaped as C(\\) to comply to YAML syntax.
    - Uses L(Python regular expressions,https://docs.python.org/3/library/re.html).
    type: str
  ignore_hidden:
    description:
    - A boolean that controls if files that start with a '.' will be included or not.
    type: bool
    default: no
    version_added: '2.0'
  validate:
    description:
    - The validation command to run before copying into place.
    - The path to the file to validate is passed in via '%s' which must be present as in the sshd example below.
    - The command is passed securely so shell features like expansion and pipes won't work.
    type: str
    version_added: '2.0'
attributes:
    action:
      support: full
    async:
      support: none
    bypass_host_loop:
      support: none
    check_mode:
      support: none
    diff_mode:
      support: full
    platform:
      platforms: posix
    safe_file_operations:
      support: full
    vault:
      support: full
      version_added: '2.2'
seealso:
- module: ansible.builtin.copy
- module: ansible.builtin.template
- module: ansible.windows.win_copy
author:
- Stephen Fromm (@sfromm)
extends_documentation_fragment:
    - action_common_attributes
    - action_common_attributes.flow
    - action_common_attributes.files
    - decrypt
    - files
a(
- name: Assemble from fragments from a directory
  ansible.builtin.assemble:
    src: /etc/someapp/fragments
    dest: /etc/someapp/someapp.conf

- name: Insert the provided delimiter between fragments
  ansible.builtin.assemble:
    src: /etc/someapp/fragments
    dest: /etc/someapp/someapp.conf
    delimiter: '### START FRAGMENT ###'

- name: Assemble a new "sshd_config" file into place, after passing validation with sshd
  ansible.builtin.assemble:
    src: /etc/ssh/conf.d/
    dest: /etc/ssh/sshd_config
    validate: /usr/sbin/sshd -t -f %s
�#N)�
AnsibleModule)�b�
indexbytes)�	to_nativeFc��tj|���\}}tj|d��}d}d}	t	tj|����D�]�}
|r|�|
��s�tj�||
��}tj�	|��r4|r3tj�
|���d��r��t|d��5}|�
��}
ddd��n#1swxYwY|	r"|�td����|rg|ret!j|��d}|�|��t%|d	��d
kr"|�td����|�|
��d}|
�td����rd}	���d}	���|���|S)z/ assemble a file from a directory of fragments )�dir�wbF�.�rbN�
r����
T)�tempfile�mkstemp�os�fdopen�sorted�listdir�search�path�join�isfile�basename�
startswith�open�read�writer�codecs�
escape_decoder	�endswith�close)�src_path�	delimiter�compiled_regexp�
ignore_hidden�tmpdir�tmpfd�	temp_path�tmp�
delimit_me�add_newline�f�fragment�fragment_fh�fragment_contents              �=/usr/lib/python3.11/site-packages/ansible/modules/assemble.py�assemble_from_fragmentsr5�s$���'�F�3�3�3��E�9�
�)�E�4�
 �
 �C��J��K�
�B�J�x�(�(�
)�
)�!�!���	�?�#9�#9�!�#<�#<�	���7�<�<��!�,�,���w�~�~�h�'�'�	�M�	�b�g�>N�>N�x�>X�>X�>c�>c�dg�>h�>h�	��
�(�D�
!�
!�	2�[�*�/�/�1�1��	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2��	��I�I�a��g�g�����	'��
'�"�0��;�;�A�>�	��	�	�)�$�$�$��i��,�,��2�2��I�I�a��g�g�&�&�&��	�	�"�#�#�#��
��$�$�Q�t�W�W�-�-�	��K�K��K�K��I�I�K�K�K��s�2D�D	�D	c���tj�|��rW	tj|��dS#tt
f$r,}|�d|�dt
|����g|d<Yd}~dSYd}~dSd}~wwxYwdS)NzUnable to remove temp file (z): �warnings)rr�exists�remove�IOError�OSErrorr
)r�result�es   r4�cleanupr>�s���	�w�~�~�d���d�	d��I�d�O�O�O�O�O����!�	d�	d�	d��!�!�OS�t�t�U^�_`�Ua�Ua�Ua�&b�%c��z�"�"�"�"�"�"�"�"�!�!�!�!�!�����	d����d�ds�7�A4�A/�/A4c�B�tttdd���td���tdd���tdd���tdd���td���tdd���td����	��d�
��}d}d}d}|jd}|jd}|jd
}|jd}|jd}d}	|jd}
|j�dd��}t||���}tj�|��s|�d|z���tj�|��s|�d|z���|�\	tj
|��}	nF#tj$r4}
|�dt|
���d|�d����Yd}
~
nd}
~
wwxYw|rd|vr|�d|z���t|||	|
|j��}|�|��}||d<	|�|��}n#t"$rd}YnwxYw||d<tj�|��r|�|��}||kr�|rb|�||z��\}}}t|||���|d<|dkr+t'|��|�d |�d!|�����|r|�|�|��|d"<|�|||jd#�$��d}t'||��|�|j��}|�||��|d%<d&|d'<|jd(i|��dS))NrT)�type�required�str)r@�boolF)r@�default)�srcr'�dest�backup�
remote_src�regexpr)�validate)�
argument_spec�add_file_common_argsrErFrGr'rIr)rJ)rErFzSource (%s) does not exist)�msgzSource (%s) is not a directoryzInvalid Regexp (z) in "�"z%szvalidate must contain %%s: %s�checksum�md5sum)�rc�stdout�stderr�
validationrzfailed to validate: rc:z error:�backup_file�
unsafe_writes)rV�changed�OKrM�)r�dict�params�getrrr8�	fail_json�isdir�re�compile�errorr
r5r*�sha1�md5�
ValueError�run_commandr>�backup_local�atomic_move�load_file_common_arguments�set_fs_attributes_if_different�	exit_json)�modulerW�	path_hash�	dest_hashrErFrGr'rIr(r)rJr<r=r�pathmd5rQ�out�err�	file_argss                    r4�mainrr�s&��
���&�4�0�0�0���&�&�&��6�D�1�1�1��V�U�3�3�3����6�6�6��U�#�#�#��F�E�:�:�:��u�%�%�%�	
�	
�	
�"�
�
�
�F��G��I��I�
�-��
�C��=�� �D�
�]�8�
$�F��
�k�*�I�
�]�8�
$�F��O��M�/�2�M��}� � ��T�2�2�H�
�c��
%�
%�
%�F�
�7�>�>�#���A����9�C�?��@�@�@�
�7�=�=����E����=��C��D�D�D�
��	[� �j��0�0�O�O���x�	[�	[�	[�����I�a�L�L�L�L�RX�RX�RX�!Y��Z�Z�Z�Z�Z�Z�Z�Z�����	[�����I�D��(�(����<�x�G��H�H�H�"�3�	�?�M�SY�S`�a�a�D����D�!�!�I�"�F�:����*�*�T�"�"�����������������F�8��	�w�~�~�d���&��K�K��%�%�	��I����	W�#�/�/��4��@�@�N�R��c�#'�2�c�#�#F�#F�#F�F�<� ��Q�w�w���
�
�
�� � � �R�R�R�QT�QT�%U� �V�V�V��	>�i�+�$*�$7�$7��$=�$=�F�=�!����4��V�]�?�5S��T�T�T����D�&�����1�1�&�-�@�@�I��=�=�i��Q�Q�F�9���F�5�M��F����v�����s*�F&�&G)�5*G$�$G)�>I�I#�"I#�__main__)NNFN)N)�
__future__rrrr@�
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNr"rr_r�ansible.module_utils.basicr�ansible.module_utils.sixrr	�ansible.module_utils._textr
r5r>rr�__name__rY�r4�<module>r~s��A�@�@�@�@�@�@�@�@�@��
�^�
�@��&
��
�
�
�
�	�	�	�	�	�	�	�	�����4�4�4�4�4�4�2�2�2�2�2�2�2�2�0�0�0�0�0�0�+�+�+�+�\d�d�d�d�P�P�P�f�z����D�F�F�F�F�F��r}

Youez - 2016 - github.com/yon3zu
LinuXploit