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: //proc/self/root/usr/lib/python3/dist-packages/cloudinit/analyze/__pycache__/dump.cpython-38.pyc
U

Ӈg��	@s�ddlZddlZddlmZmZddlmZmZmZddddddd	d
d�ZdZ	d
Z
dZdd�Zdd�Z
dd�Zdd�Zddd�Zdd�Zedkr�ee��dS)�N)�datetime�timezone)�
atomic_helper�subp�utilzfinished running cloud-initz%starting search for local datasourcesz!searching for network datasourceszrunning config moduleszfinalizing moduleszrunning modules forzrunning single module )Zfinishedz
init-local�init-network�initzmodules-configz
modules-final�modulesZsinglez%Y-%m-%d %H:%M:%S,%fz%b %d %H:%M:%S.%f %Yz%b %d %H:%M:%S %YcCs�dd�tdd�D�}|��d|krft}d|kr4t}t�|dtt��j�|�j	t
jd�}|��}n0d	|kr�t�|t
�j	t
jd�}|��}nt|�}t|�S)
NcSsg|]}tj|�qS�)�calendarZ
month_abbr)�.0�mr
r
�8/usr/lib/python3/dist-packages/cloudinit/analyze/dump.py�
<listcomp> sz#parse_timestamp.<locals>.<listcomp>��
r�.� )Ztzinfo�,)�range�split�DEFAULT_FMT�CLOUD_INIT_JOURNALCTL_FMTr�strptime�strZnowZyear�replacerZutc�	timestamp�CLOUD_INIT_ASCTIME_FMT�parse_timestamp_from_date�float)�timestampstrZmonthsZFMTZdtrr
r
r�parse_timestamps&��
�
r!cCsdt�ddg�jkS)z�GNU date includes a string containing the word GNU in it in
    help output. Posix date does not. Use this to indicate on Linux
    systems without GNU date that the extended parsing is not
    available.
    ZGNU�datez--help)r�stdoutr
r
r
r�has_gnu_date9sr$cCsRt��st�d�rd}nt�r$d}ntd|�d���tt�|ddd|g�j���S)NZgdater"z-Unable to parse timestamp without GNU date: [�]z-uz+%s.%3Nz-d)	rZis_LinuxrZwhichr$�
ValueErrorrr#�strip)r r"r
r
rrBs
��rcCs�d}dd|g}d}|D]}||krd}q,q|s4dS|�|�\}}|�d�rbd�|��dd	��}d
|kr�|�d
�\}}|d|��d7}d|kr�|��d	}	n@|��d	}	||kr�|��}|jdd
�d}n|�|	�d��}d|k�rLd}
d|k�r>|�d�d��}|�d�\}}
|�dd��dd�}|dk�rBd}ndSt|}n(|��dd�\}}
}|�|�d��}|�d�|t|�d|
�d�d�}|ddk�r�|�d�d}|�|�d�d���}||d<|��|d<|S)Nz cloud-init[z - z
 [CLOUDINIT] FT�:rr���rz,%sr)�maxsplit�
Cloud-init v.�start�runningz at �'��-rr��	cloudinit)�name�descriptionr�origin�
event_typer6Zfinish�resultr4)	r�endswith�joinr'�lstripr�stage_to_description�rstripr!)�lineZamazon_linux_2_sepZ
separators�found�sepZtimehostZeventstrr ZextraZhostnamer6Zstage_and_timestampZ
event_name�_Zevent_descriptionZ_pymodloglvl�eventr7Zdescr
r
r�parse_ci_loglinePs\





�rBc
Cs�g}d}dddg}t||g�s&td��|r4|��}n|��}|D]R}|D]H}||krHzt|�}Wn tk
r�tj�d�YnX|rH|�|�qHq@||fS)Nzstart:zfinish:r+z2Either cisource or rawdata parameters are requiredzSkipping invalid entry
)	�anyr&�
splitlines�	readlinesrB�sys�stderr�write�append)�cisourceZrawdataZeventsrAZCI_EVENT_MATCHES�datar=�matchr
r
r�dump_events�s$

rMcCs2ttj�dkrttjd�}ntj}t�t|��S)Nr)�lenrF�argv�open�stdinrZ
json_dumpsrM)rJr
r
r�main�srR�__main__)NN)rrFrrr2rrrr;rrrr!r$rrBrMrR�__name__�printr
r
r
r�<module>s.�	V