%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.9/site-packages/cloudinit/config/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.9/site-packages/cloudinit/config/__pycache__/cc_write_files.cpython-39.pyc

a

'�Dg��@s�UdZddlZddlZddlZddlmZddlmZmZddl	m
Z
ddlmZddl
mZddlmZd	Zd
ZdZe�e�Zdd
gedgd�Zeed<eee
edd�dd�Zdd�Zdeeed�dd�Zdd�Zdd�Z dd�Z!dS)z"Write Files: write arbitrary files�N)�Optional)�
url_helper�util)�Cloud)�Config)�
MetaSchema)�PER_INSTANCEi�Fz
text/plainZcc_write_files�all�write_files)�idZdistrosZ	frequencyZactivate_by_schema_keys�meta)�name�cfg�cloud�args�returncCsP|�dg�}dd�|D�}|s.t�d|�dSt�|j�}t|||jj|�dS)Nr
cSsg|]}t�|dt�s|�qS)Zdefer)r�get_cfg_option_bool�
DEFAULT_DEFER)�.0�f�r�C/usr/lib/python3.9/site-packages/cloudinit/config/cc_write_files.py�
<listcomp>$s�zhandle.<locals>.<listcomp>zESkipping module named %s, no/empty 'write_files' key in configuration)	�get�LOG�debugrZfetch_ssl_details�pathsr
ZdistroZ
default_owner)r
rrrZ	file_listZfiltered_files�ssl_detailsrrr�handle"s��rcCsf|sd}|����}|dvr"dgS|dvr2ddgS|dvr@dgS|tkrNtgS|r`t�d|t�tgS)N�)�gz�gzip�application/x-gzip)z	gz+base64zgzip+base64zgz+b64zgzip+b64�application/base64)Zb64�base64z%Unknown encoding type %s, assuming %s)�lower�strip�TEXT_PLAIN_ENCr�warning)Z
encoding_typerrr�canonicalize_extraction4s$�r))�ownerrc	Cs�|sdSt|�D]�\}}|�d�}|s:t�d|d|�qtj�|�}t|�dd�||�dd�|�dd��}|dur�t�d|d|�qt�	|�d|��\}}	t
|�d	�t�}
t�|d
�r�dnd}tj
||||
||	d
�t�|||	�qdS)N�pathz3No path provided to write for entry %s in module %s��source�content�encodingz>No content could be loaded for entry %s in module %s; skippingr*Zpermissions�append�ab�wb)�omode�mode�user�group)�	enumeraterrr(�osr+�abspath�read_url_or_decoderZextract_usergroup�decode_perms�
DEFAULT_PERMSrZ
write_fileZchownbyname)r
�filesr*r�iZf_infor+�contents�u�gZpermsr3rrrr
Ms@
�


���cCs�|dur|Sz,t|ttf�r&t|�WStt|�d�WSWnrttfy�g}||fD]8}z|�d|�WqVty�|�d|�YqV0qVtjdg|�R�|YS0dS)N�z%oz%rz0Undecodable permissions %s, returning default %s)	�
isinstance�int�float�str�	TypeError�
ValueErrorr0rr()Zperm�defaultZreps�rrrrr;us
r;cCs�|durdn
|�dd�}t|�}|dur0|s0dSd}|r�z"tj||�dd�dd|d�j}Wn$ty~t�td|�d}Yn0|dur�|s�t	|�}t
||�}|S)NZurir�headers�)rKZretriesZsec_betweenrzVFailed to retrieve contents from source "%s"; falling back to data from "contents" keyF)r�boolrZread_file_or_urlr?�	ExceptionrZlogexcrr)�extract_contents)r-rr.r/�urlZuse_url�resultZextractionsrrrr:�s2
��

r:cCsH|}|D]:}|dkr&tj|ddd�}q|dkr:t�|�}q|tkrq|S)Nr"F)�quiet�decoder#)rZdecomp_gzipr$Z	b64decoder')r?Zextraction_typesrQ�trrrrO�srO)N)"�__doc__r$Zloggingr8�typingrZ	cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.settingsrr<rr'Z	getLogger�__name__rr�__annotations__rF�listrr)�dictr
r;r:rOrrrr�<module>s0
�(%

Zerion Mini Shell 1.0