403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.6/site-packages/cloudinit/config/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_write_files.cpython-36.pyc
3

��b|+�@s�UdZddlZddlZddlmZddlmZddlmZddl	m
Z
mZmZddl
mZeZdZd	Zd
ZdZeje�ZdgZd
dddddddgZddded�eed�ed�ed�ed�ed�ged�Ze
dd d!dd"ed#�d$�d"d%ed&e�d'�d"eed(jed)��d'�d"ee�jd*d%�ed+jee�jd*d%�d,��d'�d"eeed-d.je��d/�d0d
ed1�d'�d0eed2jed3��d'�d4�d5gd
d6�d7�id8�Zeee�Zd9d:�Zd;d<�Z d=d �Z!d>d?�Z"d@dA�Z#dS)Bz"Write Files: write arbitrary files�N)�dedent)�log)�util)�
MetaSchema�get_meta_doc�validate_cloudconfig_schema)�PER_INSTANCEz	root:rooti�Fz
text/plain�all�gz�gzipz	gz+base64zgzip+base64zgz+b64zgzip+b64�b64�base64Zcc_write_fileszWrite Fileszwrite arbitrary filesa<        Write out arbitrary content to files, optionally setting permissions.
        Parent folders in the path are created if absent.
        Content can be specified in plain text or binary. Data encoded with
        either base64 or binary gzip data can be specified and will be decoded
        before being written. For empty file creation, content can be omitted.

    .. note::
        if multiline data is provided, care should be taken to ensure that it
        follows yaml formatting standards. to specify binary data, use the yaml
        option ``!!binary``

    .. note::
        Do not write files under /tmp during boot because of a race with
        systemd-tmpfiles-clean that can cause temp files to get cleaned during
        the early boot process. Use /run/somedir instead to avoid race
        LP:1707222.a)        # Write out base64 encoded content to /etc/sysconfig/selinux
        write_files:
        - encoding: b64
          content: CiMgVGhpcyBmaWxlIGNvbnRyb2xzIHRoZSBzdGF0ZSBvZiBTRUxpbnV4...
          owner: root:root
          path: /etc/sysconfig/selinux
          permissions: '0644'
        z�        # Appending content to an existing file
        write_files:
        - content: |
            15 * * * * root ship_logs
          path: /etc/crontab
          append: true
        a        # Provide gziped binary content
        write_files:
        - encoding: gzip
          content: !!binary |
              H4sIAIDb/U8C/1NW1E/KzNMvzuBKTc7IV8hIzcnJVyjPL8pJ4QIA6N+MVxsAAAA=
          path: /usr/bin/hello
          permissions: '0755'
        zt        # Create an empty file on the system
        write_files:
        - path: /root/CLOUD_INIT_WAS_HERE
        a         # Defer writing the file until after the package (Nginx) is
        # installed and its user is created alongside
        write_files:
        - path: /etc/nginx/conf.d/example.com.conf
          content: |
            server {
                server_name example.com;
                listen 80;
                root /var/www;
                location / {
                    try_files $uri $uri/ $uri.html =404;
                }
            }
          owner: 'nginx:nginx'
          permissions: '0640'
          defer: true
        )�id�name�title�description�distrosZexamples�	frequency�object�write_filesZarray�stringz�                            Path of the file to which ``content`` is decoded
                            and written
                        )�typer�a#                            Optional content to write to the provided ``path``.
                            When content is present and encoding is not '%s',
                            decode the content prior to writing. Default:
                            **''**
                        )r�defaultrz�                            Optional owner:group to chown on the file. Default:
                            **{owner}**
                        )�owner�oz�                            Optional file permissions to set on ``path``
                            represented as an octal string '0###'. Default:
                            **'{perms}'**
                        )�permsz�                            Optional encoding type of the content. Default is
                            **text/plain** and no content decoding is
                            performed. Supported encoding types are:
                            %s.z, )rr�enumrZbooleanz�                            Whether to append ``content`` to existing file if
                            ``path`` exists. Default: **false**.
                        z�                            Defer writing the file until 'final' stage, after
                            users were created, and packages were installed.
                            Default: **{defer}**.
                        )�defer)�path�contentr�permissions�encoding�appendrr)r�
propertiesZrequiredZadditionalProperties)r�items)rr$cCsFt|t�|jdg�}dd�|D�}|s8|jd|�dSt||�dS)NrcSsg|]}tj|dt�s|�qS)r)r�get_cfg_option_bool�
DEFAULT_DEFER)�.0�f�r*�$/usr/lib/python3.6/cc_write_files.py�
<listcomp>�szhandle.<locals>.<listcomp>zESkipping module named %s, no/empty 'write_files' key in configuration)r�schema�get�debugr)rZcfgZ_cloudrZ_argsZ	file_listZfiltered_filesr*r*r+�handle�s
r0cCsX|sd}|j�j�}|d
kr"dgS|dkr2d	dgS|dkr@d	gS|rRtjd|t�tgS)Nrr
rzapplication/x-gzip�	gz+base64�gzip+base64�gz+b64�gzip+b64zapplication/base64rr
z%Unknown encoding type %s, assuming %s)r
r)r1r2r3r4)rr
)�lower�strip�LOG�warning�UNKNOWN_ENC)Z
encoding_typer*r*r+�canonicalize_extractions
r:cCs�|sdSx�t|�D]�\}}|jd�}|s<tjd|d|�qtjj|�}t|jd��}t|jdd�|�}t	j
|jdt��\}}t|jd�t
�}	t	j|d	�r�d
nd}
t	j|||
|	d�t	j|||�qWdS)
Nrz3No path provided to write for entry %s in module %s�r"r rrr!r#Zab�wb)�omode�mode)�	enumerater.r7r8�osr�abspathr:�extract_contentsrZextract_usergroup�
DEFAULT_OWNER�decode_perms�
DEFAULT_PERMSr&Z
write_fileZchownbyname)r�files�iZf_inforZextractions�contents�u�grr=r*r*r+rs$
cCs�|dkr|Sy(t|ttf�r$t|�Stt|�d�SWnrttfk
r�g}xF||fD]:}y|jd|�WqVtk
r�|jd|�YqVXqVWtjd|��|SXdS)N�z%oz%r�0Undecodable permissions %s, returning default %s)rL)	�
isinstance�int�float�str�	TypeError�
ValueErrorr#r7r8)ZpermrZreps�rr*r*r+rD.srDcCsL|}xB|D]:}|dkr(tj|ddd�}q
|dkr<tj|�}q
|tkr
q
W|S)Nzapplication/x-gzipF)�quiet�decodezapplication/base64)rZdecomp_gzipr
Z	b64decoder9)rHZextraction_types�result�tr*r*r+rBCs
rB)$�__doc__r
r@�textwraprZ	cloudinitrZloggingrZcloudinit.config.schemarrrZcloudinit.settingsrrrCrEr'r9Z	getLogger�__name__r7rZsupported_encoding_types�meta�format�oct�replace�joinr-r0r:rrDrBr*r*r*r+�<module>s�
			



Youez - 2016 - github.com/yon3zu
LinuXploit