HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_seed_random.cpython-38.pyc
U

Ӈg��@s�UdZddlZddlZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZdd	lmZe�e�Zd
egegd�Ze
ed<dd
d�Zdd�Zeee	edd�dd�ZdS)z%Seed Random: Provide random seed data�N)�BytesIO)�subp�util)�Cloud)�Config)�
MetaSchema)�ALL_DISTROS)�PER_INSTANCEZcc_seed_random)�idZdistrosZ	frequencyZactivate_by_schema_keys�metacCsd|sdS|r|��dkr"t�|�S|��dkr8t�|�S|��dkrTtj|ddd�Std|��dS)N�)�raw)�base64Zb64)ZgzipZgzF)�quiet�decodez Unknown random_seed encoding: %s)�lowerr�encode_textrZ	b64decodeZdecomp_gzip�IOError)�data�encoding�r�A/usr/lib/python3/dist-packages/cloudinit/config/cc_seed_random.py�_decode s

rcCsp|s|rtd��n|s$t�d�dS|d}t�|�s\|rLtdj|d���nt�d|�dStj||dd�dS)	Nz"no command found but required=truezno command providedrz+command '{cmd}' not found but required=true)�cmdz'command '%s' not found for seed_commandF)�
update_envZcapture)�
ValueError�LOG�debugrZwhich�format)�command�requiredrrrrr�handle_random_seed_command-s



�r!)�name�cfg�cloud�args�returnc
Cs|�di�}|�dd�}|�dd�}t�}|rF|�t||�d�d��|jj}|rnd|krn|�t�|d��|��}t	|�r�t
�d|t	|�|�t�||�|�d	d�}	|�d
d�}
zt
|	|
d|id
�Wn6tk
�r}zt
�d|	|�|�W5d}~XYnXdS)NZrandom_seed�filez/dev/urandomrrr)rz0%s: adding %s bytes of random seed entropy to %srZcommand_requiredFZRANDOM_SEED_FILE)rr rz'handling random command [%s] failed: %s)�getr�writerZ
datasource�metadatarr�getvalue�lenrrZappend_filer!rZwarning)r"r#r$r%ZmycfgZ	seed_pathZ	seed_dataZseed_bufr*rZreq�errr�handle@s:��
r.)N)�__doc__rZlogging�iorZ	cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.distrosrZcloudinit.settingsr	Z	getLogger�__name__rr�__annotations__rr!�str�listr.rrrr�<module>	s$
�