3 \me# @ s d Z ddlZddlZddlZddlmZ ddlmZm Z ddl mZ dZdZ dZG d d d eZedZG dd dZG dd deZdddZejdfddZdd ZG dd dZdd ZdS )z events for reporting. The events here are designed to be used with reporting. They can be published to registered handlers with report_event. N)List)available_handlersinstantiated_handler_registry)ReportingHandlerZfinishstartZ cloudinitc @ s e Zd Zdd ZdS )_namesetc C s || kr|S t d| d S )Nz%s not a valid value)AttributeError)selfname r /usr/lib/python3.6/events.py__getattr__ s z_nameset.__getattr__N)__name__ __module____qualname__r r r r r r s r SUCCESSWARNFAILc @ s. e Zd ZdZedfddZdd Zdd ZdS ) ReportingEventz"Encapsulation of event formatting.Nc C s2 || _ || _|| _|| _|d kr(tj }|| _d S )N) event_typer descriptionorigintime timestamp)r r r r r r r r r __init__) s zReportingEvent.__init__c C s dj | j| j| jS )z"The event represented as a string.z {0}: {1}: {2})formatr r r )r r r r as_string9 s zReportingEvent.as_stringc C s | j | j| j| j| jdS )z&The event represented as a dictionary.)r r r r r )r r r r r )r r r r as_dict? s zReportingEvent.as_dict)r r r __doc__DEFAULT_EVENT_ORIGINr r r r r r r r &