MOON
Server: Apache
System: Linux vps.erhabenn.com.br 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User: machen (1008)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyc
�
d�bc@s�ddlZddlmZddlmZddlmZddlmZddl	m
Z
mZdefd��YZ
d	efd
��YZdS(i����N(tlogger(t	HttpError(tustr(trestutil(t
AGENT_NAMEtCURRENT_VERSIONtObservationcBs&eZddd�Zed��ZRS(tcCs�|dkrtd��n|dkr6td��n|dkrKd}n|dkr`d}n||_||_||_||_dS(Ns!Observation name must be provideds#Observation health must be providedR(tNonet
ValueErrortnamet
is_healthytdescriptiontvalue(tselfR
RRR
((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyt__init__s					cCs8i|jd d6|jd6|jd d6|jd d6S(Ni@tObservationNamet	IsHealthyi�tDescriptiontValue(R
RRR
(R((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pytas_obj0s

(t__name__t
__module__RtpropertyR(((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyRst
HealthServicecBs�eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
�Ze
d��Zd�Zd
�Zd�Zd�Zd�Zddd�Zd�Zd�ZRS(shttp://{0}:80/HealthServicetreporttargethealths1.0tWALinuxAgenttGuestAgentPluginHeartbeattGuestAgentPluginStatustGuestAgentPluginVersionstGuestAgentPluginArtifacttInstanceMetadataHeartbeati
cCsItjj|�|_tj|_tj|_tj|_	t
�|_dS(N(RtENDPOINTtformattendpointtAPItapitVERSIONtversiont
OBSERVER_NAMEtsourcetlisttobservations(RR"((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyRGs
cCsQi|jd6|jd6|jd6g|jD]}|j^q+d6}tj|�S(NtApitVersiontSourcetObservations(R$R&R(R*Rtjsontdumps(Rtotdata((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pytas_jsonNs


#cCs'|jdtjd|�|j�dS(sd
        Reports a signal for /health
        :param is_healthy: whether the call succeeded
        R
RN(t_observeRt&HOST_PLUGIN_HEARTBEAT_OBSERVATION_NAMEt_report(RR((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pytreport_host_plugin_heartbeatXscCs-|jdtjd|d|�|j�dS(s�
        Reports a signal for /versions
        :param is_healthy: whether the api call succeeded
        :param response: debugging information for failures
        R
RR
N(R4Rt%HOST_PLUGIN_VERSIONS_OBSERVATION_NAMER6(RRtresponse((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pytreport_host_plugin_versionsasc	Cs3|jdtjd|d|d|�|j�dS(s�
        Reports a signal for /extensionArtifact
        :param is_healthy: whether the api call succeeded
        :param source: specifies the api caller for debugging failures
        :param response: debugging information for failures
        R
RRR
N(R4Rt%HOST_PLUGIN_ARTIFACT_OBSERVATION_NAMER6(RRR(R9((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyt%report_host_plugin_extension_artifactls
cCs-|jdtjd|d|�|j�dS(s�
        Reports a signal for /status
        :param is_healthy: whether the api call succeeded
        :param response: debugging information for failures
        R
RR
N(R4Rt#HOST_PLUGIN_STATUS_OBSERVATION_NAMER6(RRR9((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pytreport_host_plugin_statusyscCs-|jdtjd|d|�|j�dS(s�
        Reports a signal for /metadata/instance
        :param is_healthy: whether the api call succeeded and returned valid data
        :param response: debugging information for failures
        R
RR
N(R4RtIMDS_OBSERVATION_NAMER6(RRR9((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pytreport_imds_status�sRc
Cs[t|j�tjkr,|jtjd4n|jjtd|d|d|d|��dS(NiR
RR
R(tlenR*RtMAX_OBSERVATIONStappendR(RR
RR
R((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyR4�scCs�tjd�zpy@tj|j|jdidd6�tjd|j|j�Wn)tk
r{}tjdt|��nXWd|j	�|j
2XdS(Ns"HealthService: report observationstheaderssapplication/jsonsContent-Types0HealthService: Reported observations to {0}: {1}s1HealthService: could not report observations: {0}(RtverboseRt	http_postR"R3RtwarnRt_report_failuresR*(Rte((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyR6�s
#
cCs�yxtjd�ddlm}m}xN|jD]C}|js0|tdtd|j	dt
dtj|j
��q0q0WWn/tk
r�}tjdjt|���nXdS(	Ns+HealthService: report failures as telemetryi����(t	add_eventtWALAEventOperationR&topt
is_successtmessages-HealthService: could not report failures: {0}(RREtazurelinuxagent.common.eventRJRKR*RRRtHealthObservationtFalseR/R0Rt	ExceptionR!R(RRJRKR1RI((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyRH�s
			(RRR R#R%R'R5R=R8R;R?RBRRR3R7R:R<R>R@R4R6RH(((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyR:s(	
				
				
(R/tazurelinuxagent.commonRt azurelinuxagent.common.exceptionRtazurelinuxagent.common.futureRtazurelinuxagent.common.utilsRtazurelinuxagent.common.versionRRtobjectRR(((sQ/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/healthservice.pyt<module>s