name : boot_hook.cpython-39.pyc
a

'�Dg��@sPddlZddlZddlmZmZmZddlmZe�e	�Z
Gdd�dej�ZdS)�N)�handlers�subp�util)�
PER_ALWAYSc@s*eZdZdgZdd�Zdd�Zdd�ZdS)	�BootHookPartHandlerz#cloud-boothookcKs2tj�|t�|�d�|_d|_|r.|��|_dS)NZ	boothooks)r�Handler�__init__rZ	get_ipath�boothook_dir�instance_idZget_instance_id)�self�pathsZ
datasource�_kwargs�r�@/usr/lib/python3.9/site-packages/cloudinit/handlers/boot_hook.pyrs
zBootHookPartHandler.__init__cCsJt�|�}tj�|j|�}tjt�|�|jdd�}t�	||�
�d�|S)Nr)�prefixi�)rZclean_filename�os�path�joinr	Zstrip_prefix_suffixZdos2unix�prefixesZ
write_file�lstrip)r�payload�filename�filepath�contentsrrr�_write_part s
�zBootHookPartHandler._write_partcCs�|tjvrdS|�||�}z8|jr0dt|j�ini}t�d�tj|g|dd�Wn@tjytt	�
td|�Yn ty�t	�
td|�Yn0dS)NZINSTANCE_IDzExecuting boothookF)Z
update_envZcapturez#Boothooks script %s execution errorz'Boothooks unknown error when running %s)rZCONTENT_SIGNALSrr
�str�LOG�debugrZProcessExecutionErrorrZlogexc�	Exception)r�dataZctyperrZ	frequencyr�envrrr�handle_part)s 
��
�zBootHookPartHandler.handle_partN)�__name__�
__module__�__qualname__rrrr!rrrrrs	r)
ZloggingrZ	cloudinitrrrZcloudinit.settingsrZ	getLoggerr"rrrrrrr�<module>s



© 2025 Cubjrnet7