HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cloudinit/handlers/__pycache__/boot_hook.cpython-310.pyc
o

�Ad��@s\ddlZddlmZddlmZddlmZmZddlmZe�	e
�ZGdd�dej�Z
dS)�N)�handlers)�log)�subp�util)�
PER_ALWAYSc@s*eZdZdgZdd�Zdd�Zdd�ZdS)	�BootHookPartHandlerz#cloud-boothookcKs6tj�|t�|�d�|_d|_|r|��|_dSdS)N�	boothooks)r�Handler�__init__r�	get_ipath�boothook_dir�instance_id�get_instance_id)�self�paths�
datasource�_kwargs�r�>/usr/lib/python3/dist-packages/cloudinit/handlers/boot_hook.pyr
s�zBootHookPartHandler.__init__cCsJt�|�}tj�|j|�}tjt�|�|jdd�}t�	||�
�d�|S)Nr)�prefixi�)r�clean_filename�os�path�joinr�strip_prefix_suffix�dos2unix�prefixes�
write_file�lstrip)r�payload�filename�filepath�contentsrrr�_write_part!s
�zBootHookPartHandler._write_partcCs�|tjvrdS|�||�}ztj��}|jdurt|j�|d<tj|g|d�WdStj	y;t
�td|�YdSt
yKt
�td|�YdSw)N�INSTANCE_ID)�envz#Boothooks script %s execution errorz'Boothooks unknown error when running %s)r�CONTENT_SIGNALSr#r�environ�copyr
�strr�ProcessExecutionErrorr�logexc�LOG�	Exception)r�data�ctyper r�	frequencyr!r%rrr�handle_part*s



��zBootHookPartHandler.handle_partN)�__name__�
__module__�__qualname__rr
r#r1rrrrrs
	r)r�	cloudinitrr�loggingrr�cloudinit.settingsr�	getLoggerr2r,r	rrrrr�<module>s